fix(changelog): Handle reverts in changelog and version inference #677
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()