Skip to content

Commit 51385e7

Browse files
committed
add automated check for CHANGELOG integrity
1 parent 89a9868 commit 51385e7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ jobs:
1919
enable-cache: true
2020
- name: Check lockfile is consistent with pyproject.toml
2121
run: uv lock --check
22+
check-changelog-history-untouched:
23+
runs-on: ubuntu-24.04
24+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-history-fix') || !startsWith(github.event.pull_request.title, 'release:') }}
25+
steps:
26+
- uses: actions/checkout@v6
27+
- name: Check if changes are limited to upcoming changes
28+
run: |
29+
upcoming_changes_start=$(git diff -W CHANGELOG.md | grep "^ ## Upcoming Changes" -n | cut -d: -f1)
30+
releases_start=$(git diff -W CHANGELOG.md | grep "^ ## " -n | tail -n +2 | head -n 1 | cut -d: -f1) # +2 to skip first line
31+
echo "All changes should be between $upcoming_changes_start and $releases_start"
32+
33+
# +6 to skip diff header
34+
git diff -W CHANGELOG.md | grep "^[^ ]" -n | tail -n +6 | cut -d: -f1 \
35+
| while read -r changed_line_nr; do
36+
echo -n "Checking line $changed_line_nr...";
37+
if [ $upcoming_changes_start -lt $changed_line_nr ] && [ $changed_line_nr -lt $releases_start ]; then
38+
echo "...valid";
39+
else
40+
echo "...invalid";
41+
echo "Detected illegal changes"
42+
exit 1
43+
fi
44+
done
2245
test:
2346
uses: ./.github/workflows/testing.yml
2447
build-docs:

0 commit comments

Comments
 (0)