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 3aa9dae
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 35 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/check_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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: |
all_pr_labels= gh pr view --json labels --jq '.labels[].name'
echo $all_pr_labels
if contains($all_pr_labels, 'Breaking change') || contains($all_pr_labels, 'Feature') || contains($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 contains($all_pr_labels, 'Dependencies') || contains($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 3aa9dae

Please sign in to comment.