fix(changelog): Handle reverts in changelog and version inference#677
Merged
fix(changelog): Handle reverts in changelog and version inference#677
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Changelog
Other
Bug Fixes 🐛ChangelogDocumentation 📚🤖 This preview updates automatically when you update the PR. |
Contributor
|
ba9d07b to
90e36a2
Compare
…on inference When generating changelogs or inferring version bumps: - Revert commits that cancel out their target (both in current changelog) are removed - Standalone reverts (target not in changelog) appear as bug fixes with patch bump - Nested reverts (Revert Revert...) are handled by processing in reverse chronological order - SHA-based matching is preferred, with title matching as fallback
9f44b7d to
30a58aa
Compare
cecc303 to
50add5c
Compare
50add5c to
ddec3b5
Compare
MathurAditya724
approved these changes
Dec 29, 2025
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.
Summary
When generating changelogs or inferring version bumps, revert commits are now handled properly:
Revert cancellation: When both a revert commit and its target are in the current changelog, they cancel each other out (neither appears in the changelog nor affects version bump)
Standalone reverts: When a revert's target is not in the current changelog (e.g., was in a previous release), the revert appears in the Bug Fixes category with a patch version bump
Nested reverts: Chains like
Revert "Revert "..."are handled correctly using a single-pass algorithm that processes commits in git log order (newest-first)Matching Strategy
PR Preview Integration
generateChangelogWithHighlight) correctly handles revert PRspr.head.shafrom GitHub API for accurate SHA matchingExamples
Changes
isRevertCommit,extractRevertedSha,extractRevertedTitle)processReverts()function with single-pass, order-agnostic algorithmgenerateRawChangelog()andgenerateChangelogWithHighlight()