Skip to content

Direct bump with changelog creation not possible using semver2, custom tag_format and prerelease option #1614

@pydal

Description

@pydal

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.10.0.20.0.3-rc.00.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

  1. 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 
  1. Create a first commit
echo "# test" | tee README.md git add README.md cz.toml git commit -m "fix: Add readme file" 
  1. Bump a prerelease
cz bump --prerelease rc --yes 
  1. 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" 
  1. Try to bump another prerelease version (failing)
cz bump --prerelease rc --yes 
  1. Generate changelog (succeeding with warning)
cz changelog 
  1. 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

  1. Changelog generation shall recognize the tags using custom tag_format with ${prerelease}
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions