Skip to content
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

Generate multiple changelogs in different formats #572

Open
1 task done
taladar opened this issue Mar 23, 2024 · 9 comments
Open
1 task done

Generate multiple changelogs in different formats #572

taladar opened this issue Mar 23, 2024 · 9 comments
Assignees
Labels
feature/request New feature or request

Comments

@taladar
Copy link

taladar commented Mar 23, 2024

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

I am currently evaluating git-cliff as a possible changelog generator for future projects. A lot of the binary (as opposed to library) Rust projects I write use two changelog files, one in markdown format for GitHub/GitLab display and one in Debian format for cargo-deb Debian packages.

It would be useful to have the option to specify multiple outputs in the git-cliff config to cover use cases like this where multiple downstream tooling options each have their own prescribed changelog formats.

Desired solution

Some way to have multiple distinct sections in the cliff.toml for outputs. I am not that familiar with the config file format yet but most likely just having a TOML array of tables for the changelog section would be enough but I don't understand the tool well enough yet to know if values from other sections might also have to be duplicated.

Alternatives considered

It might be possible to just call git-cliff twice with different config files but then some of the work is done twice and some of the config is essentially in whatever script contains those calls.

Additional context

No response

@taladar taladar added the feature/request New feature or request label Mar 23, 2024
Copy link

welcome bot commented Mar 23, 2024

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

@prewk
Copy link

prewk commented Mar 23, 2024

Another use case for this: I'd like to use git-cliff for both GitLab releases (markdown changelog) and for notifying on Slack (minimal mrkdwn changelog).

@Cyclonit
Copy link

Can you elaborate on what you'd like the workflow to look like? Assuming git-cliff supports multiple output configurations in one config file, what would you expect the cli command for generating both outputs in one run be?

@prewk
Copy link

prewk commented Mar 24, 2024

Good question, I guess I'd want one at a time, so I'd want to specify a template name or a profile or something that could perhaps encompass more things.

Maybe a bit bloated. I'm just spitballing.

@taladar
Copy link
Author

taladar commented Mar 24, 2024

Personally for my use case I would prefer if I could specify all the options in the config file (e.g. whether to prepend, what the output filename is supposed to be,..) though an option to name each config and apply only one of the named configs wouldn't really conflict with that.

@prewk
Copy link

prewk commented Mar 24, 2024

I just realized I'll probably solve all my problems by just using --config some-other-config.toml so never mind me.

@orhun
Copy link
Owner

orhun commented Mar 24, 2024

Can you share how the config file should look like if we support multiple outputs? I don't think it is an easy thing to do without doing breaking changes (we will break stuff quite a bit in #559 anyways - so that's might be the right place to discuss this).

I still think you can simply solve this by running git-cliff multiple times with different configuration files. You can also use environment variables (e.g. GIT_CLIFF__CHANGELOG__BODY) to override values.

@alerque
Copy link
Contributor

alerque commented Mar 24, 2024

I have use cases for this too. I haven't implemented it for any of the projects with this need yet but I've had my eye on doing it for a while. As best I could figure with some playing around multiple config files with non-standard locations (like cliff-plain.toml and cliff-markdown.toml) does get the job done. It just isn't very ergonomic and suffers from tooling file clutter.

I would suggest the configs could look exactly like they do now, but have [changelog] and [workspace.metadata.git-cliff.changelog] keys be the default changlog style, but introduce a new CLI flag for --style or --variant or --template (naming is hard) that took it's settings from [changelog.<variant_name>] or [workspace.metadata.git-cliff.changelog.<variante_name>] instead.

I would also set it up so the default style was used for all keys except ones explicitly set in the variant, so project defaults could be setup, then overrides for specific styles/templates/variants/whatever they are called. This is part of why the current multi-config work around is not ergonomic: a whole lot of things end up duplicated between configs. For example I might want to have git.commit_preprocessors and many other settings under [git]/[workspace.metadata.git-cliff.git] just shared across all changelog variants, but have a variant that uses just a different git.commit_parsers setting that skips more or less things.

@orhun
Copy link
Owner

orhun commented Mar 24, 2024

I like your suggestion @alerque - I think implementing this via [changelog.<variant_name>] and adding an argument for specifying a <variant_name> is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants