orhun / git-cliff

A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️
https://git-cliff.org
Apache License 2.0
8.42k stars 174 forks source link

Add option to fail on unconventional commits #536

Open ChristopherKlinge opened 4 months ago

ChristopherKlinge commented 4 months ago

Is there an existing issue or pull request for this?

Feature description

An option to fail generating the changelog if the git history contains commits that do not comply to the conventional commits format would allow using git-cliff as a quality gate. Currently additional tools are needed to implement such behaviour.

Desired solution

Add a new configuration parameter:

# fail if the git history contains commits that are not conventional (default: false)
fail_on_unconventional = true

If git-cliff encounters any unconventional commits, it should print the hashes of all unconventional commits to stderr and exit with a non-zero return code. Outputting the commits gives developers a clear indication as to what they need to fix.

$ git-cliff
Encountered unconventional commits: 12345678, abcdefg

Alternatives considered

There exist other tools that can check compliance with conventional commits. However having to use multiple tools bloats the pipeline.

Additional context

No response

welcome[bot] commented 4 months ago

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️