File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1919 enable-cache : true
2020 - name : Check lockfile is consistent with pyproject.toml
2121 run : uv lock --check
22+ protect-changelog :
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+ with :
28+ fetch-depth : 0
29+ - name : Check if changes are limited to upcoming changes
30+ if :
31+ run : |
32+ if git diff origin/main --exit-code -- CHANGELOG.md; then
33+ echo "CHANGELOD.md not changed"
34+ exit 0
35+ fi
36+
37+ upcoming_changes_start=$(git diff -W origin/main -- CHANGELOG.md | grep "^ ## Upcoming Changes" -n | cut -d: -f1)
38+ releases_start=$(git diff -W origin/main -- CHANGELOG.md | grep "^ ## " -n | tail -n +2 | head -n 1 | cut -d: -f1)
39+ # +2 to skip first line
40+ echo "All changes should be between $upcoming_changes_start and $releases_start"
41+
42+ # +6 to skip diff header
43+ git diff -W origin/main -- CHANGELOG.md | grep "^[^ ]" -n | tail -n +6 | cut -d: -f1 \
44+ | while read -r changed_line_nr; do
45+ echo -n "Checking line $changed_line_nr...";
46+ if [ $upcoming_changes_start -lt $changed_line_nr ] && [ $changed_line_nr -lt $releases_start ]; then
47+ echo "...valid";
48+ else
49+ echo "...invalid";
50+ echo "Detected illegal changes"
51+ exit 1
52+ fi
53+ done
2254 test :
2355 uses : ./.github/workflows/testing.yml
2456 build-docs :
You can’t perform that action at this time.
0 commit comments