orhun / git-cliff

A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️
https://git-cliff.org
Apache License 2.0
9.05k stars 189 forks source link

Rerender a specific tag/unreleased in the changelog #433

Open ruben-arts opened 9 months ago

ruben-arts commented 9 months ago

Describe the solution you'd like

I would like to use git-cliff in a GitHub action that runs after every merged PR. Updating the [unreleased] section. My initial instinct was that using the --prepend would have this behavior.

Describe alternatives you've considered

I could write some find replace code to manually do the replacement using the output of git-cliff.

Additional context

Example of the wokflow I'm looking for:

# CHANGELOG

## [1.2.3]
- change by @person in #1234
git merge feature/x
git-cliff -u --prepend changelog.md
# CHANGELOG

## [unreleased]
- feature x by @person in #1235

## [1.2.3]
- change by @person in #1234
git merge feature/y
git-cliff -u --prepend changelog.md
# CHANGELOG

## [unreleased]
- feature y by @person in #1236
- feature x by @person in #1235

## [1.2.3]
- change by @person in #1234
welcome[bot] commented 9 months ago

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

orhun commented 6 months ago

Also reported in #544

orhun commented 3 months ago

FWIW we can use the markdown crate for parsing the changelog.

2bndy5 commented 1 week ago

It might be a good idea to require HTML comments as markers between versions (in the tera template). That way there's some guarantee that the CHANGELOG being updated is compatible with this feature.

orhun commented 1 week ago

@2bndy5 yup, good idea. I agree that using markers is the safest way to go with this, maybe even instead of parsing markdown.