ci: validate CHANGELOG sections match base branch on PRs#72
Merged
eddietejeda merged 1 commit intomainfrom Apr 29, 2026
Merged
Conversation
Adds scripts/validate-changelog.py: each ## [version] block on the base branch must appear unchanged in CHANGELOG.md so full git-cliff regenerations cannot drop already-shipped release notes.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
||
| def main() -> None: | ||
| base = sys.argv[1] if len(sys.argv) > 1 else "origin/main" | ||
| current = Path("CHANGELOG.md").read_text() |
Contributor
There was a problem hiding this comment.
nit: read_text() is called outside the try/except, so a missing working-tree CHANGELOG.md produces a raw FileNotFoundError traceback instead of a clean error. Wrapping it gives a friendlier failure:
Suggested change
| current = Path("CHANGELOG.md").read_text() | |
| try: | |
| current = Path("CHANGELOG.md").read_text() | |
| except OSError as e: | |
| print(f"error: could not read CHANGELOG.md ({e})", file=sys.stderr) | |
| sys.exit(1) |
(not blocking)
| try: | ||
| base_text = git_show_changelog(base) | ||
| except subprocess.CalledProcessError as e: | ||
| print(f"error: could not read {base}:CHANGELOG.md ({e})", file=sys.stderr) |
Contributor
There was a problem hiding this comment.
super nit: str(CalledProcessError) reports the return code but drops git's stderr (e.g. "path 'CHANGELOG.md' does not exist in 'origin/main'"). Adding stderr=subprocess.PIPE to check_output and forwarding e.stderr here makes failures easier to diagnose. (not blocking)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
scripts/validate-changelog.pyand a CI job (pull requests only) that fails if any## [version]section present on the PR base branch differs from the working treeCHANGELOG.md.This catches regressions like git-cliff dropping bullets from already-tagged releases (PR #70 review).