Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 4517567

Browse files
authored
remove PR requirement for changie and allow multiple issues per changelog (#603)
1 parent 7d46e18 commit 4517567

File tree

2 files changed

+77
-25
lines changed

2 files changed

+77
-25
lines changed

.changie.yaml

Lines changed: 75 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,110 @@ changelogPath: CHANGELOG.md
66
versionExt: md
77
versionFormat: '## dbt-spark {{.Version}} - {{.Time.Format "January 02, 2006"}}'
88
kindFormat: '### {{.Kind}}'
9-
changeFormat: '- {{.Body}} ([#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-spark/issues/{{.Custom.Issue}}), [#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-spark/pull/{{.Custom.PR}}))'
9+
changeFormat: |-
10+
{{- $IssueList := list }}
11+
{{- $changes := splitList " " $.Custom.Issue }}
12+
{{- range $issueNbr := $changes }}
13+
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-spark/issues/nbr)" | replace "nbr" $issueNbr }}
14+
{{- $IssueList = append $IssueList $changeLink }}
15+
{{- end -}}
16+
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
17+
1018
kinds:
1119
- label: Breaking Changes
1220
- label: Features
1321
- label: Fixes
1422
- label: Under the Hood
1523
- label: Dependencies
16-
changeFormat: '- {{.Body}} ({{if ne .Custom.Issue ""}}[#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-spark/issues/{{.Custom.Issue}}), {{end}}[#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-spark/pull/{{.Custom.PR}}))'
24+
changeFormat: |-
25+
{{- $PRList := list }}
26+
{{- $changes := splitList " " $.Custom.PR }}
27+
{{- range $pullrequest := $changes }}
28+
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-spark/pull/nbr)" | replace "nbr" $pullrequest }}
29+
{{- $PRList = append $PRList $changeLink }}
30+
{{- end -}}
31+
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
32+
skipGlobalChoices: true
33+
additionalChoices:
34+
- key: Author
35+
label: GitHub Username(s) (separated by a single space if multiple)
36+
type: string
37+
minLength: 3
38+
- key: PR
39+
label: GitHub Pull Request Number (separated by a single space if multiple)
40+
type: string
41+
minLength: 1
1742
- label: Security
18-
changeFormat: '- {{.Body}} ({{if ne .Custom.Issue ""}}[#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-spark/issues/{{.Custom.Issue}}), {{end}}[#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-spark/pull/{{.Custom.PR}}))'
43+
changeFormat: |-
44+
{{- $PRList := list }}
45+
{{- $changes := splitList " " $.Custom.PR }}
46+
{{- range $pullrequest := $changes }}
47+
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-spark/pull/nbr)" | replace "nbr" $pullrequest }}
48+
{{- $PRList = append $PRList $changeLink }}
49+
{{- end -}}
50+
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
51+
skipGlobalChoices: true
52+
additionalChoices:
53+
- key: Author
54+
label: GitHub Username(s) (separated by a single space if multiple)
55+
type: string
56+
minLength: 3
57+
- key: PR
58+
label: GitHub Pull Request Number (separated by a single space if multiple)
59+
type: string
60+
minLength: 1
61+
62+
newlines:
63+
afterChangelogHeader: 1
64+
afterKind: 1
65+
afterChangelogVersion: 1
66+
beforeKind: 1
67+
endOfVersion: 1
68+
1969
custom:
2070
- key: Author
2171
label: GitHub Username(s) (separated by a single space if multiple)
2272
type: string
2373
minLength: 3
2474
- key: Issue
25-
label: GitHub Issue Number
26-
type: int
27-
minLength: 4
28-
- key: PR
29-
label: GitHub Pull Request Number
75+
label: GitHub Issue Number (separated by a single space if multiple)
3076
type: int
3177
minLength: 4
78+
3279
footerFormat: |
3380
{{- $contributorDict := dict }}
3481
{{- /* any names added to this list should be all lowercase for later matching purposes */}}
35-
{{- $core_team := list "michelleark" "peterallenwebb" "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "aranke" "mikealfare" "dependabot[bot]" "snyk-bot" "colin-rogers-dbt" }}
82+
{{- $core_team := list "michelleark" "peterallenwebb" "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "aranke" "dependabot[bot]" "snyk-bot" "colin-rogers-dbt" }}
3683
{{- range $change := .Changes }}
3784
{{- $authorList := splitList " " $change.Custom.Author }}
38-
{{- /* loop through all authors for a PR */}}
85+
{{- /* loop through all authors for a single changelog */}}
3986
{{- range $author := $authorList }}
4087
{{- $authorLower := lower $author }}
4188
{{- /* we only want to include non-core team contributors */}}
4289
{{- if not (has $authorLower $core_team)}}
43-
{{- $pr := $change.Custom.PR }}
44-
{{- /* check if this contributor has other PRs associated with them already */}}
45-
{{- if hasKey $contributorDict $author }}
46-
{{- $prList := get $contributorDict $author }}
47-
{{- $prList = append $prList $pr }}
48-
{{- $contributorDict := set $contributorDict $author $prList }}
49-
{{- else }}
50-
{{- $prList := list $change.Custom.PR }}
51-
{{- $contributorDict := set $contributorDict $author $prList }}
52-
{{- end }}
53-
{{- end}}
90+
{{- $changeList := splitList " " $change.Custom.Author }}
91+
{{- $changeLink := $change.Kind }}
92+
{{- if or (eq $change.Kind "Dependencies") (eq $change.Kind "Security") }}
93+
{{- $changeLink = "[#nbr](https://github.com/dbt-labs/dbt-spark/pull/nbr)" | replace "nbr" $change.Custom.PR }}
94+
{{- else }}
95+
{{- $changeLink = "[#nbr](https://github.com/dbt-labs/dbt-spark/issues/nbr)" | replace "nbr" $change.Custom.Issue }}
96+
{{- end }}
97+
{{- /* check if this contributor has other changes associated with them already */}}
98+
{{- if hasKey $contributorDict $author }}
99+
{{- $contributionList := get $contributorDict $author }}
100+
{{- $contributionList = append $contributionList $changeLink }}
101+
{{- $contributorDict := set $contributorDict $author $contributionList }}
102+
{{- else }}
103+
{{- $contributionList := list $changeLink }}
104+
{{- $contributorDict := set $contributorDict $author $contributionList }}
105+
{{- end }}
106+
{{- end}}
54107
{{- end}}
55108
{{- end }}
56109
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
57110
{{- if $contributorDict}}
58111
### Contributors
59112
{{- range $k,$v := $contributorDict }}
60-
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}[#{{$element}}](https://github.com/dbt-labs/dbt-spark/pull/{{$element}}){{end}})
113+
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}})
61114
{{- end }}
62115
{{- end }}

.github/workflows/bot-changelog.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# time: <current timestamp>
1010
# custom:
1111
# Author: <PR User Login (generally the bot)>
12-
# Issue: 4904
1312
# PR: <PR number>
1413
#
1514
# **why?**
@@ -40,7 +39,7 @@ jobs:
4039
matrix:
4140
include:
4241
- label: "dependencies"
43-
changie_kind: "Dependency"
42+
changie_kind: "Dependencies"
4443
- label: "snyk"
4544
changie_kind: "Security"
4645
runs-on: ubuntu-latest
@@ -58,4 +57,4 @@ jobs:
5857
commit_message: "Add automated changelog yaml from template for bot PR"
5958
changie_kind: ${{ matrix.changie_kind }}
6059
label: ${{ matrix.label }}
61-
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n Issue: 417\n PR: ${{ github.event.pull_request.number }}"
60+
custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n PR: ${{ github.event.pull_request.number }}"

0 commit comments

Comments
 (0)