diff --git a/action.yaml b/action.yaml index f514eef..1114c14 100644 --- a/action.yaml +++ b/action.yaml @@ -11,13 +11,22 @@ inputs: By default excludes 📦📝👻🚦 under the assumption these do not normally merit a release. An output of interesting = true/false will be set, the 'workflow_dispatch' (explicit release) is always 'interesting'. default: '[💥🚨🎉🐛⚠🚀🌐👷]|:(boom|tada|construction_worker):' + RELEASE_DRAFT_BODY: + required: false + description: | + Release draft body produced by `release-drafter/release-drafter` action; defaults to looking for a draft release named `next` + default: "" outputs: interesting: description: whether the category is interesting or not, true / false will be the result value: ${{ steps.interesting-category.outputs.interesting }} runs: using: composite - steps: - - run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' $GITHUB_ACTION_PATH/run.sh + steps: + - run: $GITHUB_ACTION_PATH/run.sh id: interesting-category shell: bash + env: + GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} + INTERESTING_CATEGORIES: ${{ inputs.INTERESTING_CATEGORIES }} + RELEASE_DRAFT_BODY: ${{ inputs.RELEASE_DRAFT_BODY }} diff --git a/run.sh b/run.sh index 49aa64a..ab989ef 100755 --- a/run.sh +++ b/run.sh @@ -2,8 +2,13 @@ set -euxo pipefail if [ $GITHUB_EVENT_NAME = check_run ] then - RESULT=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body' | egrep "$INTERESTING_CATEGORIES" || echo 'failed') - if [[ $RESULT != 'failed' ]]; then + if [ -z "$RELEASE_DRAFT_BODY" ] + then + RELEASE_DRAFT_BODY="$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body')" + fi + + if echo "$RELEASE_DRAFT_BODY" | egrep "$INTERESTING_CATEGORIES" + then echo "::set-output name=interesting::true" else echo "::set-output name=interesting::false"