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_messageWhat would be the equivalent of this inside a pyproject.toml file?
Activity
[-]Content to be added or fixed[/-][+]customize changelog through config file[/+]Lee-W commentedon Dec 19, 2022
I don't think we currently support this behavior. So I just added a feature label to this one. Let me know if you think "documentation" is a better label for this issue
Corfucinas commentedon Dec 19, 2022
I think the "feature" is more appropriate, thanks!
robertschweizer commentedon Mar 29, 2023
I would love to see this exposed in the
pyproject.tomlconfig file!I think the pyproject.toml needs to allow defining an alternative Jinja template (file path or multi-line string in pyproject.toml) instead of the default
keep_a_changelog_template.j2.Lee-W commentedon Apr 5, 2023
"file path" sounds to be a more reasonable solution to me 🤔
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…
feat(template): allow to override the template from cli, configuratio…