-
- Notifications
You must be signed in to change notification settings - Fork 301
Description
Description
When using a custom tag_format like ${major}.${minor}-${patch}${prerelease}
with semver2
the changelog cannot be create directly using cz bump --prerelase rc
with update_changelog_on_bump = true
. Only generating the changelog manually using cz ch
lets the bump succeed.
The error occurse in a bump chain 0.0.1
→ 0.0.2
→ 0.0.3-rc.0
→ 0.0.3-rc.1
Furthermore, using prereleases, cz changelog
always throw warnings like:
Invalid version tag: '0.0-2rc.0' does not match any configured tag format
It seems that the git tag is not parsed correctly when using custom tag_format and semver2.
See a szenario in steps to reproduce.
Steps to reproduce
- Initialize git project and place cz configuration:
git init . cat << EOF | tee cz.toml [tool.commitizen] name = "cz_conventional_commits" tag_format = "\${major}.\${minor}-\${patch}\${prerelease}" version_scheme = "semver2" version = "0.0.1" update_changelog_on_bump = true EOF
- Create a first commit
echo "# test" | tee README.md git add README.md cz.toml git commit -m "fix: Add readme file"
- Bump a prerelease
cz bump --prerelease rc --yes
- Add changes, commit and create changelog
echo "Some changes" | tee -a README.md git add README.md git commit -m "fix: Add changes to readme file"
- Try to bump another prerelease version (failing)
cz bump --prerelease rc --yes
- Generate changelog (succeeding with warning)
cz changelog
- Try to bump prerelease version again (succeeding)
cz bump --prerelease rc
Current behavior
Bumping without prior changelog generation fails with:
Invalid version tag: '0.0-2rc.0' does not match any configured tag format
Only if the changelog is created before bumping (so that # Unreleased
heading appears) let's you create a bump.
Furthermore commitizen does not recognize custom tags with prerelease part correctly, resulting in warnings using cz changelog
like:
Invalid version tag: '0.0-2rc.1' does not match any configured tag format Invalid version tag: '0.0-2rc.0' does not match any configured tag format
Desired behavior
- Changelog generation shall recognize the tags using custom tag_format with
${prerelease}
- Bumping with changelog creation shall succeed without generating changelog before
Screenshots
n/a
Environment
Commitizen Version: 4.9.1
Python Version: 3.9.21 (main, Aug 19 2025, 00:00:00)
[GCC 11.5.0 20240719 (Red Hat 11.5.0-5)]
Operating System: Linux