Skip to content

Commit

Permalink
Merge pull request #5 from jetersen/patch-1
Browse files Browse the repository at this point in the history
support action input for release draft body
  • Loading branch information
jglick committed Jun 13, 2022
2 parents 661d206 + e19d1ee commit 53539d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 11 additions & 2 deletions action.yaml
Expand Up @@ -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 }}
9 changes: 7 additions & 2 deletions run.sh
Expand Up @@ -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"
Expand Down

0 comments on commit 53539d5

Please sign in to comment.