Fix changelog tag detection logic
What does this MR do and why?
Contributes to #437616 (closed)
Problem
ChangelogTagFinder
allows user to provide a version in semver
format (without v at the beginning). However, DEFAULT_TAG_REGEX
lets
to use v
at the start of the string.
As a result, VersionSorter
cannot correctly sort versions and user
receives an error that the version is incorrect.
Solution
- Convert user specified version to format that
VersionSorter
supports. - Add test to verify that versions like
v1.0.0
are accepted. - Update Changelog API documentation
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before
{
"message": "Failed to generate the changelog: The commit start range is unspecified, and no previous tag could be found to use instead"
}
After
{
"notes": "## v1.1.0 (2024-02-06)\n\nNo changes.\n"
}
How to set up and validate locally
- Visit http://127.0.0.1:3000/api/v4/projects/2/repository/changelog?version=v1.1.0
- You should see response with
notes
instead of an error message
Edited by Vasilii Iakliushin