fix: improve semantic versioning regex and history parsing#701
fix: improve semantic versioning regex and history parsing#701dhairya-pandya wants to merge 2 commits intotattle-made:mainfrom
Conversation
📝 WalkthroughWalkthroughModifies semantic-release parsing and commit range handling: preserves original case while using lowercase variants for detection, expands conventional-commit parsing (breaking marker '!' support, broader BREAKING CHANGE detection), adds more type aliases, changes git range semantics, and adds per-commit debug logging. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@scripts/semantic_release_workflow.py`:
- Around line 129-134: The current check in semantic_release_workflow.py uses
the variables message and lower_message and only looks for the substring
"breaking change", so "BREAKING-CHANGE" footers are missed; update the logic
that determines a major bump (the if "breaking change" in lower_message branch)
to also detect the hyphenated variant e.g. by matching a pattern like
"breaking[- ]change" against lower_message or by normalizing hyphens to spaces
before the check, ensuring both "breaking change" and "breaking-change" trigger
return "major".
🧹 Nitpick comments (1)
scripts/semantic_release_workflow.py (1)
296-299: Optional: guard debug logging to avoid noisy CI output.If this runs on every workflow, the per-commit prints can be quite chatty; a simple flag keeps logs lean when not troubleshooting.
♻️ Suggested tweak
- print(f"DEBUG: {package_path} commit: '{commit}' -> bump: {commit_bump}") + if os.getenv("SEMVER_DEBUG") == "1": + print(f"DEBUG: {package_path} commit: '{commit}' -> bump: {commit_bump}")
Checks for breaking-change in the message
Pull Request concerning to Issue #680
Description
I've updated the semantic versioning script to fix the issue where feat: commits were being incorrectly downgraded to patch bumps.
The main problem was a strict regex that couldn't handle breaking change markers (!) or flexible spacing before the colon. Since the script has a silent fallback to patch whenever the regex fails, these features weren't being caught correctly.
Changes
Updated the commit parser: The regex is now more robust and supports feat!:, standard scopes (), and legacy square bracket scopes [] and even blank spaces.
Explicit Breaking Changes: The script now specifically checks for the ! marker to trigger MAJOR bumps.
Corrected Git Range: Fixed the git log boundary to properly exclude the previous release commit.
Debug Visibility: Added some print statements so we can see exactly how each commit is being parsed in the GitHub Action logs.
Verification
I tested this locally across various commit formats (standard, scoped, breaking) to ensure they all map to the correct semantic version.
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.