From cddf9920d38702b0d036610f22329383e9df0778 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 16 Feb 2021 17:32:21 -0500 Subject: [PATCH] Fixes #1: avoid releasing after check_run unless changelog looks interesting --- action.yaml | 9 ++++++++- run.sh | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index db7fa40..1e1a216 100644 --- a/action.yaml +++ b/action.yaml @@ -7,8 +7,15 @@ inputs: required: true MAVEN_TOKEN: required: true + INTERESTING_CATEGORIES: + required: true + description: | + Regexp of emojis from https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.yml representing changes of interest to users. + By default excludes 📦📝👻🚦 under the assumption these do not normally merit a release. + Ignored when using workflow_dispatch (explicit release); when using the check_run trigger (automatic), the release is skipped unless the draft changelog matches. + default: '[💥🚨🎉🐛⚠🚀👷]|:(boom|tada|construction_worker):' runs: using: composite steps: - - run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} MAVEN_USERNAME=${{ inputs.MAVEN_USERNAME }} MAVEN_TOKEN=${{ inputs.MAVEN_TOKEN }} $GITHUB_ACTION_PATH/run.sh + - run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} MAVEN_USERNAME=${{ inputs.MAVEN_USERNAME }} MAVEN_TOKEN=${{ inputs.MAVEN_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' $GITHUB_ACTION_PATH/run.sh shell: bash diff --git a/run.sh b/run.sh index 9b95318..e4a3f9d 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,9 @@ #!/bin/bash set -euxo pipefail +if [ $GITHUB_EVENT_NAME = check_run ] +then + gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body' | egrep "$INTERESTING_CATEGORIES" +fi export MAVEN_OPTS=-Djansi.force=true mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always -Dset.changelist -DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ -Pquick-build clean deploy version=$(mvn -B -ntp -Dset.changelist -Dexpression=project.version -q -DforceStdout help:evaluate)