Skip to content

Commit

Permalink
Rename check release notes action to check labels and add validation …
Browse files Browse the repository at this point in the history
…to enforce adding a valid label
  • Loading branch information
jreij committed Apr 29, 2024
1 parent 2b87b09 commit ba4e206
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 35 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/check_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Check Labels

# Every PR should have a label and some labels should include an update to the release notes
on:
pull_request:
branches-ignore:
- 'main'
types: [ synchronize, labeled, unlabeled ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
labels-check:
# https://github.com/actions/virtual-environments/
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Check PR labels
run: |
echo "${{ toJson(github.event.pull_request.labels.*.name) }}"
all_pr_labels= $(jq -c '.[]' <<< ${{ toJson(github.event.pull_request.labels.*.name) }} )
echo "$all_pr_labels"
if [ "${all_pr_labels[@]}" =~ 'Breaking change' || "${all_pr_labels[@]}" =~ 'Feature' || "${all_pr_labels[@]}" =~ 'Fix' ]
then
git fetch origin develop --depth 1
if [ -n "$(git diff origin/develop RELEASE_NOTES.md)" ]
then
echo "RELEASE_NOTES.md was updated"
exit 0
else
echo "::error::Add release notes for your PR by updating RELEASE_NOTES.md"
exit 1
fi
if [ "${all_pr_labels[@]}" =~ 'Dependencies' || "${all_pr_labels[@]}" =~ 'Chore' ]
then
echo "No extra actions needed for used labels"
exit 0
fi
echo "::error::You must add a valid label to this PR"
exit 1
1 change: 1 addition & 0 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches-ignore:
- 'main'
- 'develop'
types: [ opened, synchronize, reopened ]

concurrency:
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/check_release_notes.yml

This file was deleted.

0 comments on commit ba4e206

Please sign in to comment.