-
-
Notifications
You must be signed in to change notification settings - Fork 195
43 lines (37 loc) · 1.18 KB
/
changelog.yml
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
32
33
34
35
36
37
38
39
40
41
42
43
name: Changelog
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
jobs:
check:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for [skip changelog]
run: |
PR_DESCRIPTION=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json body -q '.body')
if echo "$PR_DESCRIPTION" | grep -q "\[skip changelog\]"; then
echo "Skip changelog found in PR description. Passing the action."
exit 0
else
exit 1
fi
- name: Check for changes in doc/CHANGES.md
if: failure()
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
FILES_CHANGED=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})
if [[ "$FILES_CHANGED" == *"doc/CHANGES.md"* ]]; then
echo "doc/CHANGES.md has been modified. Passing the action."
exit 0
else
echo "doc/CHANGES.md has not been modified. Failing the action."
exit 1
fi