Skip to content

customize changelog through config file #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
Corfucinas opened this issue Dec 16, 2022 · 4 comments
Closed
2 of 3 tasks

customize changelog through config file #640

Corfucinas opened this issue Dec 16, 2022 · 4 comments
Labels
type: feature A new enhacement proposal

Comments

@Corfucinas
Copy link

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?

@Lee-W Lee-W changed the title Content to be added or fixed customize changelog through config file Dec 19, 2022
@Lee-W Lee-W added type: feature A new enhacement proposal and removed type: documentation labels Dec 19, 2022
@Lee-W
Copy link
Member

Lee-W commented 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
Copy link
Author

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

I think the "feature" is more appropriate, thanks!

@robertschweizer
Copy link
Contributor

I would love to see this exposed in the pyproject.toml config file!

What would be the equivalent of this inside a pyproject.toml 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
Copy link
Member

Lee-W commented Apr 5, 2023

"file path" sounds to be a more reasonable solution to me 🤔

@Lee-W Lee-W closed this as completed in 7306fa9 Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new enhacement proposal
Projects
None yet
Development

No branches or pull requests

3 participants