-
Notifications
You must be signed in to change notification settings - Fork 1
Enhance action.yml with releaseMethod input #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
7c72a57
dc09b3f
d7bee26
0565a0d
7ce025a
f8de035
0fcf210
a5722da
6a3a7a9
0c8c708
efb237f
51c01cb
be878b2
c45f8b8
95c5ca5
0573904
96b63b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,12 +8,14 @@ inputs: | |||||||||||||||
| app-path: | ||||||||||||||||
| description: "Path to the project’s pom.xml file" | ||||||||||||||||
| required: true | ||||||||||||||||
| releaseMethod: | ||||||||||||||||
| description: "Release-Methode = patch, minor oder major" | ||||||||||||||||
| required: false | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Reject invalid release methods instead of silently producing a patch release. An unset or misspelled value (for example, Proposed fix releaseMethod:
description: "Release-Methode = patch, minor oder major"
required: false
+ default: "patch"+ case "$RELEASE_METHOD" in
+ patch|minor|major) ;;
+ *) echo "Invalid releaseMethod: $RELEASE_METHOD" >&2; exit 1 ;;
+ esac📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did you close that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh api graphql \
-F owner="it-at-m" \
-F name="lhm_actions" \
-F number="342" \
-f query='
query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes {
id
isResolved
resolvedBy { login }
comments(first: 20) {
nodes {
databaseId
author { login }
body
createdAt
}
}
}
}
}
}
}' \
--jq '
.data.repository.pullRequest.reviewThreads.nodes[]
| select(any(.comments.nodes[]; .databaseId == 3672365573))
| {
id,
isResolved,
resolvedBy: (.resolvedBy.login // null),
comments: [.comments.nodes[] | {
databaseId,
author: .author.login,
createdAt,
body
}]
}
'Length of output: 3660
The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how should i validate?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||
|
|
||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| releaseVersion: | ||||||||||||||||
| description: "Version to be released" | ||||||||||||||||
| required: true | ||||||||||||||||
| developmentVersion: | ||||||||||||||||
| description: "Next version with snapshot" | ||||||||||||||||
| required: true | ||||||||||||||||
| required: false | ||||||||||||||||
|
|
||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| skipDeployment: | ||||||||||||||||
| description: "Skip deployment to Maven Central" | ||||||||||||||||
| default: "true" | ||||||||||||||||
|
|
@@ -40,7 +42,7 @@ inputs: | |||||||||||||||
| outputs: | ||||||||||||||||
| MVN_ARTIFACT_ID: | ||||||||||||||||
| description: "Artifact name from pom" | ||||||||||||||||
| value: ${{ steps.maven-release-step.outputs.MVN_ARTIFACT_ID }} | ||||||||||||||||
| value: ${{ steps.maven-release-step.outputs.RELEASE }} | ||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| artifact-name: | ||||||||||||||||
| description: "Name of the artifact upload" | ||||||||||||||||
| value: ${{steps.artifact-name.outputs.artifact-name}} | ||||||||||||||||
|
|
@@ -97,13 +99,36 @@ runs: | |||||||||||||||
| USE_PR: ${{ inputs.use-pr != 'true' }} | ||||||||||||||||
| APP_PATH: ${{inputs.app-path}} | ||||||||||||||||
| RELEASE_VERSION: ${{ inputs.releaseVersion }} | ||||||||||||||||
| DEPLOYMENT_VERSION: ${{ inputs.developmentVersion }} | ||||||||||||||||
| # DEPLOYMENT_VERSION: ${{ inputs.developmentVersion }} | ||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| RELEASE_METHOD: ${{ inputs.releaseMethod }} | ||||||||||||||||
| DARGUMENTS: ${{ inputs.mavenDArgsInput }} | ||||||||||||||||
| run: | | ||||||||||||||||
| # configure git | ||||||||||||||||
| git config --global user.email "github-actions@github.com" | ||||||||||||||||
| git config --global user.name "GitHub Actions" | ||||||||||||||||
|
|
||||||||||||||||
| # get maven artifact id and provide as output | ||||||||||||||||
| MVN_ARTIFACT_ID=$(mvn -f ./$APP_PATH/pom.xml org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -DforceStdout | tee /dev/stderr | tail -n 1) | ||||||||||||||||
| echo $MVN_ARTIFACT_ID | ||||||||||||||||
| echo "MVN_ARTIFACT_ID=$MVN_ARTIFACT_ID" >> $GITHUB_OUTPUT | ||||||||||||||||
|
|
||||||||||||||||
| MVN_VERSION=$(mvn -f $APP_PATH/pom.xml $MAVEN_CLI_OPTS org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout ) | ||||||||||||||||
|
|
||||||||||||||||
| if [ -v $RELEASE_VERSION ]; then RELEASE="${MVN_VERSION/-SNAPSHOT/""}"; else RELEASE=$RELEASE_VERSION; fi | ||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| echo $RELEASE | ||||||||||||||||
| if [ "$RELEASE_METHOD" == "major" ]; then MAJOR=$(( $(echo $RELEASE | awk -F. '{print $1}') + 1 )); else MAJOR=$(echo $RELEASE | awk -F. '{print $1}'); fi | ||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| if [ "$RELEASE_METHOD" == "major" ]; then MINOR=0; elif [ "$RELEASE_METHOD" == "minor" ]; then MINOR=$(( $(echo $RELEASE | awk -F. '{print $2}' ) + 1 )); else MINOR=$(echo $RELEASE | awk -F. '{print $2}' ); fi | ||||||||||||||||
| if [ "$RELEASE_METHOD" != "major" ] && [ "$RELEASE_METHOD" != "minor" ]; then PATCH=$(( $(echo $RELEASE | awk -F. '{print $3}') + 1 )); else PATCH=0; fi | ||||||||||||||||
| DEVELOPMENT_VERSION=$(echo $MAJOR.$MINOR.$PATCH-SNAPSHOT) | ||||||||||||||||
| echo "apfel" | ||||||||||||||||
|
hupling marked this conversation as resolved.
Outdated
|
||||||||||||||||
| echo $MVN_ARTIFACT_IDe | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
why print again?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. das war zu test zwecken. weil es einfach nicht funktioniert hat entferne ich wieder |
||||||||||||||||
| echo RELEASE=$RELEASE >> $GITHUB_OUTPUT | ||||||||||||||||
| echo $DEVELOPMENT_VERSION | ||||||||||||||||
| echo "DEVELOPMENT_VERSION=$DEVELOPMENT_VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| # prepare the maven arguments | ||||||||||||||||
| MAVEN_ARGS="-DpushChanges=$USE_PR -DremoteTagging=false -DlocalCheckout=true" | ||||||||||||||||
| # set maven deploy skip if skipDeployment is true | ||||||||||||||||
|
|
@@ -113,13 +138,10 @@ runs: | |||||||||||||||
|
|
||||||||||||||||
| # run maven release | ||||||||||||||||
| mvn release:prepare release:perform -f ./$APP_PATH/pom.xml -B \ | ||||||||||||||||
| -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEPLOYMENT_VERSION \ | ||||||||||||||||
| -DreleaseVersion=$RELEASE -DdevelopmentVersion=$DEVELOPMENT_VERSION \ | ||||||||||||||||
| $MAVEN_ARGS \ | ||||||||||||||||
| -Darguments="$DARGUMENTS" | ||||||||||||||||
| # get maven artifact id and provide as output | ||||||||||||||||
| MVN_ARTIFACT_ID=$(mvn -f ./$APP_PATH/pom.xml org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -q -DforceStdout) | ||||||||||||||||
| echo $MVN_ARTIFACT_ID | ||||||||||||||||
| echo "MVN_ARTIFACT_ID=$MVN_ARTIFACT_ID" >> $GITHUB_OUTPUT | ||||||||||||||||
|
|
||||||||||||||||
| - id: artifact-name | ||||||||||||||||
| name: Set output variable $GITHUB_OUTPUT | ||||||||||||||||
| run: echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT" | ||||||||||||||||
|
|
@@ -135,8 +157,8 @@ runs: | |||||||||||||||
| if: ${{ inputs.use-pr == 'true' }} | ||||||||||||||||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||||||||||||||||
| with: | ||||||||||||||||
| title: "chore(${{ inputs.app-path }}): bump release version to ${{ inputs.developmentVersion }}" | ||||||||||||||||
| branch: "release-${{ inputs.app-path }}-${{ inputs.developmentVersion }}" | ||||||||||||||||
| title: "chore(${{ inputs.app-path }}): bump release version to ${{ steps.maven-release-step.outputs.DEVELOPMENT_VERSION }}" | ||||||||||||||||
| branch: "release-${{ inputs.app-path }}-${{ steps.maven-release-step.outputs.DEVELOPMENT_VERSION }}" | ||||||||||||||||
| base: "${{ github.ref_name }}" | ||||||||||||||||
| body: "This PR is auto-generated" | ||||||||||||||||
| assignees: "${{ github.actor }}" | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not kebab case?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ja, weil ich es so gemacht habe, wie bei releaseVersion. dann machen wir alles in kebal case außer releaseVersiom wegen Altbestand