Description
Type
- Content inaccurate
- Content missing
- Typo
URL
https://commitizen-tools.github.io/commitizen/customization/#custom-changelog-generator
Description
This section explains how to customize the behavior of cz
using toml
, .json
and .yml
file formats. If a project opts for the modern pyproject.toml
file, customizing becomes very easy by adding a [tool.commitizen]
section.
This works great and fast (no additional files, dependencies, or installs). However, if somebody wants to customize the changelog (see #513 ), the only given example us by creating a python file and subclassing it from BaseCommitizen
. There's also the problem of initiating this class which requires four steps (or just using cookiecutter gh:commitizen-tools/commitizen_cz_template
).
It would be a great improvement to show how to customize the CHANGELOG by just using the toml
file.
Particularly I'm interested in referencing the commit hash
inside it; an example is given on the website
def changelog_message_builder_hook(self, parsed_message: dict, commit: git.GitCommit) -> dict:
rev = commit.rev
m = parsed_message["message"]
parsed_message["message"] = f"{m} {rev} [{commit.author}]({commit.author_email})"
return parsed_message
What would be the equivalent of this inside a pyproject.toml
file?