-
Notifications
You must be signed in to change notification settings - Fork 25
31 lines (26 loc) · 1.06 KB
/
changelog-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Changelog Checker
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
branches:
- main
jobs:
changelog-check:
if: "!contains(github.event.pull_request.labels.*.name, 'pr/no-changelog')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # by default the checkout action doesn't check out all branches
- name: Check for changelog entry in diff
run: |
# Check if there's a diff on CHANGELOG.md
changelog_diff=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- CHANGELOG.md)
if [ -z "$changelog_diff" ]; then
echo "Did not detect changes in CHANGELOG.md"
echo "If no changelog entry is needed, skip this check with the 'pr/no-changelog' label"
exit 1
else
echo "Found changelog entry in PR!"
fi