-
-
Notifications
You must be signed in to change notification settings - Fork 226
fix: validate bumped version against tag pattern #1137
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
base: main
Are you sure you want to change the base?
fix: validate bumped version against tag pattern #1137
Conversation
When using --bumped-version with a tag pattern configured, git-cliff now validates the generated version against the pattern and returns an error if it doesn't match. Fixes orhun#1095
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1137 +/- ##
==========================================
- Coverage 40.16% 40.14% -0.02%
==========================================
Files 21 21
Lines 1900 1906 +6
==========================================
+ Hits 763 765 +2
- Misses 1137 1141 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thanks for the PR!
This looks good, however I'm not sure how it relates to #1095 - did you maybe link to an incorrect issue there?
return Err(Error::ChangelogError(format!( | ||
"Bumped version '{}' does not match configured tag pattern '{}'", | ||
next_version, | ||
tag_pattern | ||
))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Err(Error::ChangelogError(format!( | |
"Bumped version '{}' does not match configured tag pattern '{}'", | |
next_version, | |
tag_pattern | |
))); | |
return Err(Error::ChangelogError(format!( | |
"Bumped version '{next_version}' does not match \ | |
configured tag pattern '{tag_version}'", | |
))); |
When using --bumped-version with a tag pattern configured, git-cliff now validates the generated version against the pattern and returns an error if it doesn't match.
Fixes #1095
Description
Added validation for the bumped version against the configured tag pattern. When using
--bumped-version
with a tag pattern configured, git-cliff will now check if the generated version matches the pattern. If it doesn't match, it will return an error with a descriptive message instead of silently creating a non-compliant version.Motivation and Context
Previously, when using
--bumped-version
with a tag pattern configured, git-cliff would generate a version (e.g. "0.1.0") without validating it against the configured tag pattern. This could lead to confusion when the generated version doesn't match the project's versioning scheme.This change ensures that the generated version complies with the project's versioning pattern, providing better consistency and immediate feedback when there's a mismatch.
How Has This Been Tested?
Added a new test case
test_bump_version_with_tag_pattern
that verifies:The test covers both success and failure scenarios, ensuring proper error handling and pattern validation.
Types of Changes
Checklist: