cmd/gopherbot: label Tools issues automatically Automatically label any issues with x/tools in the title. This will make them easier to search. Change-Id: Ib2b1b9d6b208d2c0748282a5cdeb8c7705483f61 Reviewed-on: https://go-review.googlesource.com/c/build/+/194360 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index 5794048..9d1f818 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go
@@ -285,6 +285,7 @@ {"label build issues", (*gopherbot).labelBuildIssues}, {"label mobile issues", (*gopherbot).labelMobileIssues}, {"label documentation issues", (*gopherbot).labelDocumentationIssues}, + {"label tools issues", (*gopherbot).labelToolsIssues}, {"handle gopls issues", (*gopherbot).handleGoplsIssues}, {"close stale WaitingForInfo", (*gopherbot).closeStaleWaitingForInfo}, {"cl2issue", (*gopherbot).cl2issue}, @@ -878,6 +879,15 @@ }) } +func (b *gopherbot) labelToolsIssues(ctx context.Context) error { + return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error { + if gi.Closed || gi.PullRequest || !strings.HasPrefix(gi.Title, "x/tools") || gi.HasLabel("Tools") || gi.HasEvent("unlabeled") { + return nil + } + return b.addLabel(ctx, gi, "Tools") + }) +} + // handleGoplsIssues labels and asks for additional information on gopls issues. // // This is necessary because gopls issues often require additional information to diagnose,