fix: prevent false-positive major bumps from breaking change detection#1048
Merged
Conversation
777e989 to
fc94f2d
Compare
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
There was a problem hiding this comment.
Pull request overview
This PR tightens ShipJS’ major-version bump detection to better follow Conventional Commits: it avoids triggering majors from incidental prose, and adds support for the ! header marker while requiring the BREAKING CHANGE: / BREAKING-CHANGE: footer format.
Changes:
- Require
BREAKING CHANGE:/BREAKING-CHANGE:(with:) for major bump detection in commit bodies (reduces false positives). - Detect major bumps from
!in commit titles (e.g.,feat!:,fix(scope)!:). - Normalize commit type parsing so
feat!:is counted asfeatfor minor/patch classification logic.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/shipjs-lib/src/lib/util/getNextVersion.js | Updates major bump detection to use a breaking-change footer regex and adds !-header major detection. |
| packages/shipjs-lib/src/lib/util/getCommitNumbersPerType.js | Strips trailing ! from parsed commit type so feat!: is classified correctly. |
| packages/shipjs-lib/src/lib/util/tests/getNextVersion.spec.js | Adds tests for hyphenated footer detection, prose false-positive prevention, and ! title handling. |
| packages/shipjs-lib/src/lib/const.js | Changes GIT_COMMIT_BREAKING_CHANGE from a string to a regex aligned with the spec. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
BREAKING CHANGE:/BREAKING-CHANGE:footer colon separator per the Conventional Commits spec!suffix in commit titles (e.g.feat!:,fix(scope)!:) to trigger major bumps!from prefixes ingetCommitNumbersPerTypesofeat!:is correctly classified asfeatTest plan
BREAKING-CHANGE:(hyphen variant) triggers majorfeat!:triggers majorfix(scope)!:triggers major