From e60c656e7cef10a0676843099224d97573925b7e Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Fri, 15 Mar 2024 10:59:43 -0400 Subject: [PATCH] Modify issue labeler to skip linked issues (#10199) * Modify issue labeler to skip linked issues * Update tests --- tools/issue-labeler/labeler/backfill.go | 8 ++++++++ tools/issue-labeler/labeler/backfill_test.go | 12 +++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/issue-labeler/labeler/backfill.go b/tools/issue-labeler/labeler/backfill.go index 12db0cc04238..89eed2d58077 100644 --- a/tools/issue-labeler/labeler/backfill.go +++ b/tools/issue-labeler/labeler/backfill.go @@ -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) diff --git a/tools/issue-labeler/labeler/backfill_test.go b/tools/issue-labeler/labeler/backfill_test.go index c58e7f14b8e6..36ffa8defee3 100644 --- a/tools/issue-labeler/labeler/backfill_test.go +++ b/tools/issue-labeler/labeler/backfill_test.go @@ -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, @@ -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{}, }, }