From 672cbca5d47084c945dd77746e8cb04eda79f94e Mon Sep 17 00:00:00 2001 From: Markus Hoffrogge Date: Sun, 1 Sep 2024 17:06:19 +0200 Subject: [PATCH] Enhance maven-cd.yml with input to enforce validate only - maven-cd.yml: - add input validate_only with default to 'false' - extend jobs.validate.outpus.should_release to ${{ inputs.validate_only == 'false' && ... }} - add step validate.steps.log-should_release-details to log details of the should_release flag to leverage analysis --- .github/workflows/maven-cd.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven-cd.yml b/.github/workflows/maven-cd.yml index e467db6..2b3e0e8 100644 --- a/.github/workflows/maven-cd.yml +++ b/.github/workflows/maven-cd.yml @@ -3,6 +3,14 @@ name: maven-cd on: workflow_call: + inputs: + validate_only: + type: string + required: false + description: | + Validate with release drafter only + => Skip release job + default: false secrets: MAVEN_USERNAME: required: true @@ -14,7 +22,8 @@ jobs: validate: runs-on: ubuntu-latest outputs: - should_release: ${{ steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }} + # If this is being changed, then align step log-should_release-details below! + should_release: ${{ inputs.validate_only == 'false' && steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }} steps: - name: Verify CI status uses: jenkins-infra/verify-ci-status-action@v1.2.2 @@ -39,6 +48,23 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_DRAFT_BODY: ${{ steps.draft.outputs.body }} + - name: Log should_release details + id: log-should_release-details + run: | + echo "================================" + echo "Release job filter details:" + echo " VALIDATE_ONLY: ${VALIDATE_ONLY}" + echo " CI_STATUS: ${CI_STATUS}" + echo " INTERESTING_CATEGORY: ${INTERESTING_CATEGORY}" + echo "--------------------------------" + echo "=> SHOULD_RELEASE: ${SHOULD_RELEASE}" + echo "================================" + env: + VALIDATE_ONLY: ${{ inputs.validate_only }} + CI_STATUS: ${{ steps.verify-ci-status.outputs.result }} + INTERESTING_CATEGORY: ${{ steps.interesting-categories.outputs.interesting }} + # This must be equal to output should_release of job validate above! + SHOULD_RELEASE: ${{ inputs.validate_only == 'false' && steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }} release: runs-on: ubuntu-latest needs: [validate]