-
-
Notifications
You must be signed in to change notification settings - Fork 18
fix(changelog): Handle revert commits properly in changelog and version inference #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BYK
wants to merge
7
commits into
master
Choose a base branch
from
byk/fix/revert-behavior
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,408
−54
Conversation
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
…tries By default, conventional commit type prefixes (e.g., 'feat(api): ') are now stripped from changelog entries. The scope is preserved when entries aren't grouped under a scope header. This is controlled via named capture groups in commit_patterns: - (?<type>...) - The prefix to strip - (?<scope>...) - The scope to preserve when no scope header is shown Users can disable stripping by using non-capturing groups in their patterns.
Previously, 'Other' header for scopeless entries was only shown when there were scopes with 2+ entries (getting their own header). This caused confusion when a single unscoped entry appeared after a scope header, looking like it was part of that scope. Now 'Other' header is shown whenever there are any scoped entries, except when scopeless is the only group (where 'Other' would be meaningless).
When a scope has 2+ entries it gets its own header (e.g., '#### Api'). Single-scope entries and scopeless entries now go under an 'Other' header to clearly separate them from the grouped scopes. This prevents confusion where single entries appeared to belong to the previous scope's header.
- Test that single-scope entries get 'Other' header when scope groups exist - Test that no 'Other' header when only scopeless entries - Test that no 'Other' header when all scopes are single-entry
Contributor
Suggested Version Bump🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Changelog
OtherBug Fixes 🐛Documentation 📚🤖 This preview updates automatically when you update the PR. |
Contributor
|
f1a7804 to
ba9d07b
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
ba9d07b to
90e36a2
Compare
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 by processing reverts in reverse chronological order
Matching Strategy
Examples
Changes
isRevertCommit,extractRevertedSha,extractRevertedTitle)processReverts()function with reverse-chronological processinggenerateRawChangelog()andgenerateChangelogWithHighlight()