-
Notifications
You must be signed in to change notification settings - Fork 122
52 lines (46 loc) · 1.68 KB
/
changelog-check.yml
File metadata and controls
52 lines (46 loc) · 1.68 KB
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
44
45
46
47
48
49
50
51
52
name: Check CHANGELOG
on:
pull_request:
branches:
- main
jobs:
check-changelog:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'Release: v')"
steps:
- name: checkout code
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
with:
fetch-depth: 0
- name: setup python
uses: ./.github/actions/setup-python
id: setup-python
- name: Check for changes
run: |
BASE=$(git merge-base HEAD origin/main)
ALL_CHANGES=$(git diff --name-only "$BASE"...HEAD)
# only ignore docs/ and .md files in root
IGNORE_REGEX='(^docs/|^[^/]+\.md$)'
NON_IGNORED_CHANGES=$(echo "$ALL_CHANGES" | grep -Ev "$IGNORE_REGEX" || true)
if [ "$NON_IGNORED_CHANGES" == "" ]; then
echo "No relevant changes detected. Skipping changelog check."
exit 0
fi
CHANGIE=$(echo "$ALL_CHANGES" | grep -E "\.changes/unreleased/.*\.yaml" || true)
if [ "$CHANGIE" == "" ]; then
echo "No files added to '.changes/unreleased/'. Make sure you run 'changie new'."
exit 1
fi
CHANGELOG=$(echo "$ALL_CHANGES" | grep -E "CHANGELOG\.md" || true)
if [ "$CHANGELOG" != "" ]; then
echo "Don't edit 'CHANGELOG.md' manually nor run 'changie merge'."
exit 1
fi
- name: Validate unreleased changelog entries
uses: miniscruff/changie-action@6dcc2533cac0495148ed4046c438487e4dceaa23
with:
version: latest
args: next auto