Skip to content

Commit 7936910

Browse files
Copilotweinong
andauthored
chore: update CHANGELOG.md for v0.2.15 (#738)
* Initial plan * chore: update changelog for v0.2.15 release Co-authored-by: weinong <4204090+weinong@users.noreply.github.com> * fix: exclude changelog update PRs from changelog generation Co-authored-by: weinong <4204090+weinong@users.noreply.github.com> * fix: exclude PRs with 'release' label from changelog generation Co-authored-by: weinong <4204090+weinong@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: weinong <4204090+weinong@users.noreply.github.com>
1 parent 385f8f6 commit 7936910

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## [0.2.15]
4+
5+
### Bug Fixes
6+
7+
* PoP token flow crash with nil pointer in cache.Replace when running non-root by @vineeth-thumma in https://github.com/Azure/kubelogin/pull/736
8+
9+
### Enhancements
10+
11+
* feat: automate CHANGELOG.md generation for releases by @Copilot in https://github.com/Azure/kubelogin/pull/737
12+
13+
**Full Changelog**: https://github.com/Azure/kubelogin/compare/v0.2.14...v0.2.15
14+
315
## [0.2.14]
416

517
### Maintenance

hack/changelog-generator/main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ func isReleasePR(title string) bool {
163163
return releasePRTitle.MatchString(strings.TrimSpace(title))
164164
}
165165

166+
// hasLabel returns true if the PR has a label with the given name (case-insensitive).
167+
func hasLabel(pr GitHubPR, name string) bool {
168+
for _, l := range pr.Labels {
169+
if strings.EqualFold(l.Name, name) {
170+
return true
171+
}
172+
}
173+
return false
174+
}
175+
166176
// getMergedPRsSince returns all merged PRs after the given time.
167177
func getMergedPRsSince(repo string, since time.Time) ([]GitHubPR, error) {
168178
out, err := ghAPI(
@@ -179,7 +189,7 @@ func getMergedPRsSince(repo string, since time.Time) ([]GitHubPR, error) {
179189
}
180190
var prs []GitHubPR
181191
for _, pr := range all {
182-
if !pr.MergedAt.IsZero() && pr.MergedAt.After(since) && !isReleasePR(pr.Title) {
192+
if !pr.MergedAt.IsZero() && pr.MergedAt.After(since) && !isReleasePR(pr.Title) && !hasLabel(pr, "release") {
183193
prs = append(prs, pr)
184194
}
185195
}

hack/changelog-generator/main_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func TestIsReleasePR(t *testing.T) {
151151
{"Bump Go to 1.24.11", false},
152152
{"docs: update readme", false},
153153
{"[Bug Fix] - PoP token crash", false},
154+
{"chore: update CHANGELOG.md for v0.2.15", false},
154155
}
155156
for _, tc := range cases {
156157
got := isReleasePR(tc.title)
@@ -159,3 +160,20 @@ func TestIsReleasePR(t *testing.T) {
159160
}
160161
}
161162
}
163+
164+
func TestHasLabel(t *testing.T) {
165+
pr := GitHubPR{Labels: []Label{{Name: "release"}, {Name: "chore"}}}
166+
if !hasLabel(pr, "release") {
167+
t.Error("expected hasLabel to return true for 'release'")
168+
}
169+
if !hasLabel(pr, "Release") {
170+
t.Error("expected hasLabel to be case-insensitive")
171+
}
172+
if hasLabel(pr, "bug") {
173+
t.Error("expected hasLabel to return false for 'bug'")
174+
}
175+
empty := GitHubPR{}
176+
if hasLabel(empty, "release") {
177+
t.Error("expected hasLabel to return false for PR with no labels")
178+
}
179+
}

0 commit comments

Comments
 (0)