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

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

Closed
miniscruff opened this issue Sep 7, 2024 Discussed in #698 · 0 comments · Fixed by #708
Closed

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

miniscruff opened this issue Sep 7, 2024 Discussed in #698 · 0 comments · Fixed by #708
Assignees

Comments

@miniscruff
Copy link
Owner

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 #698

Originally posted by sheldonhull August 29, 2024
Trying this...

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:

- _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

- _🐛 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.

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

Successfully merging a pull request may close this issue.

1 participant