Skip to content

Commit

Permalink
Merge pull request #1586 from Adyen/fix/release-notes-check
Browse files Browse the repository at this point in the history
Remove opened triggers from the release notes check action
  • Loading branch information
jreij authored Apr 30, 2024
2 parents eaac3fa + a2f04c7 commit 0266193
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[//]: # (If this is a bug fix: include a reproduction path)

## Checklist <!-- Remove any line that's not applicable -->
- [ ] PR is labelled <!-- Breaking change, Feature, Fix, Dependencies or Chore -->
- [ ] Code is unit tested
- [ ] Changes are tested manually
- [ ] Link to related issues
- [ ] Add relevant labels to PR <!-- Breaking change, Feature, Fix or Dependencies. If none of these labels are applicable (for example refactor tasks or release PRs) do not use any labels -->
- [ ] Related issues are linked

COAND-XXX
48 changes: 48 additions & 0 deletions .github/workflows/check_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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_json=$(cat <<EOF
${{ toJson(github.event.pull_request.labels.*.name) }}
EOF
)
all_pr_labels=$(jq -r '.[]' <<< "$all_pr_labels_json")
echo "PR labels: $all_pr_labels"
if [[ "${all_pr_labels[@]}" =~ 'Breaking change' || "${all_pr_labels[@]}" =~ 'Feature' || "${all_pr_labels[@]}" =~ 'Fix' ]]
then
echo "Checking if release notes were added..."
git fetch origin develop --depth 1
if [ -n "$(git diff origin/develop RELEASE_NOTES.md)" ]
then
echo "Release notes were updated."
exit 0
else
echo "::error::Add release notes for your PR by updating RELEASE_NOTES.md"
exit 1
fi
elif [[ "${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
35 changes: 0 additions & 35 deletions .github/workflows/check_release_notes.yml

This file was deleted.

0 comments on commit 0266193

Please sign in to comment.