Skip to content

Commit fc948b1

Browse files
committed
Include PRs that use tide squashing
1 parent 98553ea commit fc948b1

File tree

5 files changed

+83
-7
lines changed

5 files changed

+83
-7
lines changed

hack/tools/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ require (
3535
cloud.google.com/go/compute v1.23.3 // indirect
3636
cloud.google.com/go/compute/metadata v0.2.3 // indirect
3737
cloud.google.com/go/iam v1.1.5 // indirect
38-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
3938
github.com/MakeNowJust/heredoc v1.0.0 // indirect
4039
github.com/Masterminds/goutils v1.1.1 // indirect
4140
github.com/Masterminds/semver/v3 v3.2.0 // indirect

hack/tools/release/notes/list.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,24 @@ func (l *githubFromToPRLister) listPRs() ([]pr, error) {
119119
return prs, nil
120120
}
121121

122-
var mergeCommitMessage = regexp.MustCompile(`(?m)^Merge pull request #(\d+) .*$`)
122+
var (
123+
mergeCommitMessage = regexp.MustCompile(`(?m)^Merge pull request #(\d+) .*$`)
124+
tideSquashedCommitMessage = regexp.MustCompile(`(?m)^.+\(#(?P<number>\d+)\)$`)
125+
)
123126

124127
func buildSetOfPRNumbers(commits []githubCommitNode) map[string]struct{} {
125128
prNumbers := make(map[string]struct{})
126129
for _, commit := range commits {
127130
match := mergeCommitMessage.FindStringSubmatch(commit.Commit.Message)
128-
if len(match) != 2 {
131+
if len(match) == 2 {
132+
prNumbers[match[1]] = struct{}{}
129133
continue
130134
}
131-
prNumbers[match[1]] = struct{}{}
135+
136+
match = tideSquashedCommitMessage.FindStringSubmatch(commit.Commit.Message)
137+
if len(match) == 2 {
138+
prNumbers[match[1]] = struct{}{}
139+
}
132140
}
133141

134142
return prNumbers

hack/tools/release/notes/list_test.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//go:build tools
2+
// +build tools
3+
4+
/*
5+
Copyright 2023 The Kubernetes Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
20+
package main
21+
22+
import (
23+
"testing"
24+
25+
. "github.com/onsi/gomega"
26+
)
27+
28+
func Test_buildSetOfPRNumbers(t *testing.T) {
29+
tests := []struct {
30+
name string
31+
commits []githubCommitNode
32+
want map[string]struct{}
33+
}{
34+
{
35+
name: "merge commit",
36+
commits: []githubCommitNode{
37+
{
38+
Commit: githubCommit{
39+
Message: "Merge pull request #9072 from k8s-infra-cherrypick-robot/cherry-pick-9070-to-release-1.5\n\n[release-1.5] :bug: Change tilt debug base image to golang",
40+
},
41+
},
42+
},
43+
want: map[string]struct{}{
44+
"9072": {},
45+
},
46+
},
47+
{
48+
name: "squashed commit by tide",
49+
commits: []githubCommitNode{
50+
{
51+
Commit: githubCommit{
52+
Message: ":seedling: Add dependabot groups. Allow additional patch updates (#9263)\n\n* Allow patch updates on dependabot ignore list\n\nSigned-off-by: user <[email protected]>\n\n* Add dependency groups for dependabot\n\nSigned-off-by: user <[email protected]>\n\n---------\n\nSigned-off-by: user <[email protected]>",
53+
},
54+
},
55+
},
56+
want: map[string]struct{}{
57+
"9263": {},
58+
},
59+
},
60+
}
61+
for _, tt := range tests {
62+
t.Run(tt.name, func(t *testing.T) {
63+
g := NewWithT(t)
64+
g.Expect(buildSetOfPRNumbers(tt.commits)).To(Equal(tt.want))
65+
})
66+
}
67+
}

hack/tools/release/notes/process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var (
5353
"clusterresourceset": "ClusterResourceSet",
5454
"machinedeployment": "MachineDeployment",
5555
"ipam": "IPAM",
56-
"provider/bootstrap-kubeadm": "CAPBK",
56+
"provider/bootstrap-kubeadm": "CABPK",
5757
"provider/infrastructure-in-memory": "CAPIM",
5858
"provider/core": "Core",
5959
"runtime-sdk": "Runtime SDK",

hack/tools/release/notes/test/golden/v1.5.0.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ REPLACE ME: A couple sentences describing the deprecation, including links to do
1717

1818
## Changes since v1.4.0
1919
## :chart_with_upwards_trend: Overview
20-
- 335 new commits merged
20+
- 339 new commits merged
2121
- 4 breaking changes :warning:
2222
- 19 feature additions ✨
2323
- 67 bugs fixed 🐛
@@ -150,6 +150,7 @@ REPLACE ME: A couple sentences describing the deprecation, including links to do
150150
- ClusterClass: Cluster/topology: use cached MD list in get current state (#8922)
151151
- ClusterClass: Deprecate rolloutAfter in cluster topology (#8324)
152152
- ClusterClass: Upgrading control plane should only be blocked if MD are upgrading (not just rolling out) (#8658)
153+
- clusterctl: Add CABPOCNE and CACPOCNE Providers (#9068)
153154
- clusterctl: Add labels to OWNERS file (#8342)
154155
- clusterctl: Add move annotation on objects for cluster move operation (#8322)
155156
- clusterctl: Bump controller-tools to v0.12 (#8581)
@@ -179,6 +180,7 @@ REPLACE ME: A couple sentences describing the deprecation, including links to do
179180
- Dependency: Bump github.com/onsi/ginkgo/v2 from 2.9.5 to 2.9.7 (#8792)
180181
- Dependency: Bump github.com/onsi/ginkgo/v2 from 2.9.7 to 2.10.0 (#8839)
181182
- Dependency: Bump github.com/onsi/gomega from 1.27.4 to 1.27.5 (#8390)
183+
- Dependency: Bump github.com/onsi/gomega from 1.27.5 to 1.27.6 (#8460)
182184
- Dependency: Bump github.com/onsi/gomega from 1.27.6 to 1.27.7 (#8715)
183185
- Dependency: Bump github.com/onsi/gomega from 1.27.7 to 1.27.8 (#8841)
184186
- Dependency: Bump github.com/prometheus/client_golang from 1.14.0 to 1.15.0 (#8541)
@@ -293,7 +295,7 @@ REPLACE ME: A couple sentences describing the deprecation, including links to do
293295
- util: Move `internal.labels` to `format` package for use by providers (#9006)
294296
- util: Rename internal/util/ssa util functions for better naming consistency (#8423)
295297

296-
:book: Additionally, there have been 72 contributions to our documentation and book. (#8252, #8279, #8284, #8288, #8293, #8307, #8308, #8309, #8319, #8327, #8351, #8355, #8363, #8375, #8383, #8397, #8416, #8419, #8439, #8446, #8447, #8454, #8508, #8509, #8510, #8511, #8520, #8521, #8552, #8554, #8559, #8580, #8587, #8593, #8596, #8597, #8612, #8613, #8630, #8632, #8651, #8661, #8673, #8686, #8699, #8701, #8712, #8719, #8729, #8740, #8753, #8760, #8762, #8763, #8775, #8779, #8781, #8782, #8787, #8798, #8802, #8805, #8812, #8843, #8854, #8901, #8924, #8932, #8955, #8956, #8958, #8960)
298+
:book: Additionally, there have been 74 contributions to our documentation and book. (#8252, #8279, #8284, #8288, #8293, #8307, #8308, #8309, #8319, #8327, #8351, #8355, #8363, #8375, #8383, #8397, #8416, #8419, #8439, #8446, #8447, #8454, #8508, #8509, #8510, #8511, #8520, #8521, #8544, #8552, #8554, #8559, #8580, #8587, #8593, #8596, #8597, #8612, #8613, #8630, #8632, #8651, #8661, #8673, #8686, #8699, #8701, #8712, #8719, #8729, #8740, #8753, #8760, #8762, #8763, #8775, #8779, #8781, #8782, #8787, #8798, #8802, #8805, #8812, #8843, #8854, #8901, #8924, #8932, #8955, #8956, #8958, #8960, #8980)
297299

298300

299301
_Thanks to all our contributors!_ 😊

0 commit comments

Comments
 (0)