miniscruff / changie

Automated changelog tool for preparing releases with lots of customization options
https://changie.dev/
MIT License
692 stars 36 forks source link

Format with change data should include a kind key and kind label #706

Closed miniscruff closed 1 month ago

miniscruff commented 1 month ago

The solution to the below problem is there is currently no way to get the kind label from a change. Right now the .Kind value is the key. This will probably be more obvious in the new config rework but kinds have two important values depending on context, the key and label.

  1. Add KindKey as an alias/preferred way of getting the key.
  2. Add KindLabel as a new value to get the label.

Discussed in https://github.com/miniscruff/changie/discussions/698

Originally posted by **sheldonhull** August 29, 2024 Trying this... ```yaml footerFormat: | {{- $seen := dict -}} {{- $sortedKeys := list -}} {{- range .Changes -}} {{/* printf "%v+\n" . */}} {{- $key := printf "%s|%s" .Kind .Body -}} {{- $sortedKeys = append $sortedKeys $key -}} {{- end -}} {{- $sortedKeys = sortAlpha $sortedKeys -}} {{- range $sortedKeys -}} {{- $split := splitList "|" . -}} {{- $kind := index $split 0 -}} {{- $body := index $split 1 -}} {{- $key := printf "%s|%s" $kind $body -}} {{- if not (hasKey $seen $key) -}} {{- $_ := set $seen $key true }} - _{{ $kind }}_: {{ $body -}} {{ end -}} {{- end -}} kindFormat: '' changeFormat: '' Kind: skipGlobalChoices: true kinds: - label: ✨ New Feature key: new-feature auto: minor - label: 🔨 Parameter Change (Optional) key: parameter-change-optional auto: minor - label: 🐛 Bug Fix key: bug-fix auto: patch ``` This produces output like this: ```markdown - _dependencies_: Renovate update major: terraform-provider azurerm. - _dependencies_: Renovate update minor: git-tags azure-pipeline-templates. - _dependencies_: Renovate update minor: github-releases aquaproj/aqua-registry. ``` What I would expect ```markdown - _🐛 Bug Fix_: Renovate update major: terraform-provider azurerm. - _🐛 Bug Fix_: Renovate update minor: git-tags azure-pipeline-templates. - _🐛 Bug Fix_: Renovate update minor: github-releases aquaproj/aqua-registry. ``` Still not seeing Kind label in either changeFormat or footer work with the label, only seems to use the key value.