orhun / git-cliff

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

Annotate commits by path #491

Open DanCardin opened 5 months ago

DanCardin commented 5 months ago

Is your feature request related to a problem? Please describe.

We are generating a centralized changelog for different sub-projects within a monorepo. At present, we're using --include-path to generate N separate changelogs.

However, a given commit can span multiple sub-projects, and the total "changelog" produced by unioning each individual path's result can be long and contain a lot of duplication.

I can see a few different ways of enabling the above workflow to produce a result that's much more compact.

Describe the solution you'd like

  1. The ability to annotate "named paths" and have that be accessible inside the "context".

    [named-paths]
    "lib/foo" = "Foo"
    "lib/bar" = "Bar"
    "service/Baz" = "BaZ"

    producing a "named-paths": ["Foo", "Bar", "Baz"] in the context, enabling one to customize the template to render those paths alongside each commit line-item in their respective sections

  2. The ability to execute git-cliff against externally deserialized context

    git-cliff --include-path lib/foo --output foo.json
    git-cliff --include-path lib/bar --output bar.json
    # jq magic that deduplicates commits and annotates them in some way that does something like the above
    git-cliff --from-context combined-context.json
  3. The ability to --include-paths multiple times (supported already), but expose the (full set of) matched paths to the context, for similar reasons to option 1.

welcome[bot] commented 5 months ago

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