Skip to content

🐛 fix(release): format changelog with pre-commit before committing#3717

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-release-changelog
Feb 17, 2026
Merged

🐛 fix(release): format changelog with pre-commit before committing#3717
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix-release-changelog

Conversation

@gaborbernat
Copy link
Member

The release process generates changelog.rst using towncrier, but towncrier's output doesn't always match our pre-commit formatting rules. 📝 This leads to the release commit containing unformatted changelog text that later gets flagged by CI, requiring follow-up formatting commits.

This PR modifies the release script to run pre-commit on the generated changelog.rst immediately after towncrier builds it but before creating the release commit. The pre-commit hooks apply all necessary formatting (line wrapping, trailing whitespace removal, etc.) so the changelog is properly formatted from the start.

The implementation catches and handles the case where pre-commit makes changes (exit code 1), stages those changes, and includes them in the release commit. This keeps the release history clean without requiring manual intervention or subsequent formatting commits.

@gaborbernat gaborbernat force-pushed the fix-release-changelog branch 2 times, most recently from 6d301aa to 57314b7 Compare February 17, 2026 01:38
The release process runs towncrier to generate changelog.rst, but towncrier's
output may not match our pre-commit formatting rules (line wrapping, trailing
whitespace, etc.). This causes the release commit to contain unformatted
changelog text that later gets flagged by CI.

Run pre-commit on the generated changelog.rst immediately after towncrier
completes but before creating the release commit. This ensures the changelog
is properly formatted from the start, avoiding subsequent formatting commits
and keeping the release history clean.

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
@gaborbernat gaborbernat force-pushed the fix-release-changelog branch from 57314b7 to a3aad1e Compare February 17, 2026 01:39
@gaborbernat gaborbernat merged commit 5191a92 into tox-dev:main Feb 17, 2026
28 checks passed
@gaborbernat gaborbernat deleted the fix-release-changelog branch February 18, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant