Skip to content

Commit

Permalink
Modify issue labeler to skip linked issues (GoogleCloudPlatform#10199)
Browse files Browse the repository at this point in the history
* Modify issue labeler to skip linked issues

* Update tests
  • Loading branch information
roaks3 authored and balanaguharsha committed May 2, 2024
1 parent 822f23d commit e60c656
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 8 additions & 0 deletions tools/issue-labeler/labeler/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ func ComputeIssueUpdates(issues []Issue, regexpLabels []RegexpLabel) []IssueUpda
continue
}

// Decision was made to no longer add new service labels to linked tickets, because it is
// more difficult to know which teams have received those tickets and which haven't.
// Forwarding a ticket to a different service team should involve removing the old service
// label and `linked` label.
if linked {
continue
}

var issueUpdate IssueUpdate
for label := range desired {
issueUpdate.OldLabels = append(issueUpdate.OldLabels, label)
Expand Down
12 changes: 3 additions & 9 deletions tools/issue-labeler/labeler/backfill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestComputeIssueUpdates(t *testing.T) {
},
},
},
"add missing service labels even if already linked": {
"don't add missing service labels if already linked": {
issues: []Issue{
{
Number: 1,
Expand All @@ -145,14 +145,8 @@ func TestComputeIssueUpdates(t *testing.T) {
PullRequest: map[string]any{},
},
},
regexpLabels: defaultRegexpLabels,
expectedIssueUpdates: []IssueUpdate{
{
Number: 1,
Labels: []string{"forward/linked", "service/service1", "service/service2-subteam1"},
OldLabels: []string{"service/service2-subteam1", "forward/linked"},
},
},
regexpLabels: defaultRegexpLabels,
expectedIssueUpdates: []IssueUpdate{},
},
}

Expand Down

0 comments on commit e60c656

Please sign in to comment.