Skip to content

Commit

Permalink
actions: add CHANGELOG validation script
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Berning <[email protected]>
  • Loading branch information
sam-berning committed Dec 23, 2024
1 parent 514c420 commit 64e4208
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ jobs:
- run: make twoliter check-fmt
- run: make twoliter check-clippy
- run: make twoliter check-shell
- run: ./tools/validate-changelog.sh
- run: make ARCH="${{ matrix.arch }}"
12 changes: 12 additions & 0 deletions tools/validate-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# check that all `# headers` are formatted as a version, e.g. v1.2.3
# this should be sufficient to validate the CHANGELOG for our CI, provided that
# every new tag has a corresponding CHANGELOG update, as we always parse the
# CHANGELOG between two headers with a tagged version.
if diff <(grep -ne '^# ' CHANGELOG.md) <(grep -ne '^# v[0-9]\+\.[0-9]\+\.[0-9]\+' CHANGELOG.md); then
echo "CHANGELOG validation PASSED!"
else
echo "CHANGELOG validation FAILED! Headers must match the regex '^# v[0-9]\+\.[0-9]\+\.[0-9]\+.'"
exit 1
fi

0 comments on commit 64e4208

Please sign in to comment.