Skip to content

Commit

Permalink
support action input for release draft body
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen authored Jun 3, 2022
1 parent 661d206 commit 3de4d09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ 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 github action
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:
steps:
- run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' $GITHUB_ACTION_PATH/run.sh
id: interesting-category
shell: bash
6 changes: 5 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
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 [ -z "$RELEASE_DRAFT_BODY" ]; then
RESULT=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body' | egrep "$INTERESTING_CATEGORIES" || echo 'failed')
else
RESULT=$(echo "$RELEASE_DRAFT_BODY" | egrep "$INTERESTING_CATEGORIES" || echo 'failed')
fi
if [[ $RESULT != 'failed' ]]; then
echo "::set-output name=interesting::true"
else
Expand Down

0 comments on commit 3de4d09

Please sign in to comment.