Skip to content

customize changelog through config file #640

Closed

Description

@Corfucinas

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?

Activity

  1. changed the title [-]Content to be added or fixed[/-] [+]customize changelog through config file[/+] on Dec 19, 2022
  2. Lee-W commented on Dec 19, 2022

    @Lee-W
    Member

    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

  3. Corfucinas commented on Dec 19, 2022

    @Corfucinas
    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!

  4. robertschweizer commented on Mar 29, 2023

    @robertschweizer
    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.

  5. Lee-W commented on Apr 5, 2023

    @Lee-W
    Member

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

  6. added 2 commits that reference this issue on May 9, 2023
    1f605fd
    1ca2a45
  7. added a commit that references this issue on Jun 7, 2023
    d3c89d9
  8. added 9 commits that reference this issue on Aug 5, 2023
    77b89d9
    1a40da9
    4417261
    6e8e37e
    672aef3
    877b333
    0a3fcd9
    c1ae9b4
    396b390
  9. added a commit that references this issue on Sep 24, 2023
    a9ad22e
  10. added 2 commits that reference this issue on Oct 16, 2023
    fe92588
    199fd08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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