Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support action input for release draft body #5

Merged
merged 6 commits into from Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion action.yaml
Expand Up @@ -11,13 +11,20 @@ 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:
steps:
- run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' $GITHUB_ACTION_PATH/run.sh
id: interesting-category
shell: bash
env:
RELEASE_DRAFT_BODY: ${{ inputs.RELEASE_DRAFT_BODY }}
jetersen marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion run.sh
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
RELEASE_DRAFT_BODY="$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body')"
fi

RESULT=$(echo "$RELEASE_DRAFT_BODY" | egrep "$INTERESTING_CATEGORIES" || echo 'failed')
if [[ $RESULT != 'failed' ]]; then
jetersen marked this conversation as resolved.
Show resolved Hide resolved
echo "::set-output name=interesting::true"
else
Expand Down