Skip to content

Changelog can be generated with non-version tags as a header #741

Closed
@sacha-c

Description

@sacha-c

Description

Changelogs should be generated only with version tags as headers. Tags are indeed being checked that they are version tags when generating the changelog here, but this logic is missing for the latest commit's tag.

This means that changelogs can be generated with an incorrect tag for the latest version

I've already opened a PR to fix this issue here, I hope that's okay and is useful! 🙂
I'm open to suggestions if you see anything to improve there of course

Steps to reproduce

On a project with commitizen setup

  1. touch some-change
  2. git commit -m "feat: some change"
  3. git tag a-tag-that-has-nothing-to-do-with-versions
  4. cz changelog --dry-run

See that the output is

## a-tag-that-has-nothing-to-do-with-versions (2023-05-10)

### Feat

- some change

instead of

## Unreleased
...

or

## 0.1.0 (2023-05-10)
...

Current behavior

Non-version tags can appear as the latest version header of the changelog

Desired behavior

Only version tags should ever appear in the changelog, for the latest change & subsequent changes

Screenshots

No response

Environment

Commitizen Version: 3.2.1
Python Version: 3.10.8 (main, Dec 27 2022, 10:58:47) [Clang 14.0.0 (clang-1400.0.29.202)]
Operating System: Darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions