You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Markdown changelogs with YAML frontmatter cause false version detection / NoRevisionError #2014
Hi team! First of all, thanks for this great project — commitizen is a joy to use ❤️
I searched for existing issues on frontmatter, SPDX, and NoRevisionError but did not find anything related, so here goes.
Describe the bug
When a markdown changelog contains YAML frontmatter (delimited by ---), the regex RE_TITLE in markdown.py matches # lines inside the frontmatter as markdown headings. This causes parse_version_from_title to feed non-version text to search_version, which can extract false version numbers from it.
The line # SPDX-License-Identifier: Apache-2.0 matches RE_TITLE, and search_version extracts 2.0 from the text apache-2.0. Since no git tag 2.0 exists, this results in NoRevisionError (exit code 16) when running cz bump --changelog.
Expected behavior
Lines within YAML frontmatter (--- delimiters) should be skipped during metadata parsing so they are not interpreted as markdown headings.
Environment
commitizen version: 4.16.3 (installed via uv)
Python: 3.13 (inside uv venv)
OS: Debian GNU/Linux Testing (forky)
Workaround / patch
The fix adds a get_metadata_from_file override in markdown.py that filters out YAML frontmatter lines before delegating to the parent parser:
Hi @bearomorphism & @Lee-W, would you be fine with a PR? Or do you rather consider this such an edge case that it's not worth fixing? I am just asking because this issue is blocking me a bit and I'd like to know how to proceed. Thanks for your feedback!
Frontmatters come in different shapes, you are assuiming --- and yaml, but those are not all the cases. We are not going to hardcode a solution that fits only your use case.
You can create your own "commitizen.changelog_format"
Feedback is welcome, and we can also change the plugin's name if it's too ambiguous. Finding the correct "wording" here was probably the most difficult part (and I think I failed TBH 🤭).
Activity
redtux commentedon Jun 14, 2026
Hi @bearomorphism & @Lee-W, would you be fine with a PR? Or do you rather consider this such an edge case that it's not worth fixing? I am just asking because this issue is blocking me a bit and I'd like to know how to proceed. Thanks for your feedback!
woile commentedon Jun 14, 2026
Frontmatters come in different shapes, you are assuiming
---andyaml, but those are not all the cases. We are not going to hardcode a solution that fits only your use case.You can create your own "commitizen.changelog_format"
redtux commentedon Jun 26, 2026
Thanks for the feedback!
In case anyone else needs this, I published my plugin here:
https://pypi.org/project/commitizen-spdx-changelog/
Feedback is welcome, and we can also change the plugin's name if it's too ambiguous. Finding the correct "wording" here was probably the most difficult part (and I think I failed TBH 🤭).