cmd/gopherbot: label go.dev issues

go.dev and pkg.go.dev now use the Go issue tracker. This will save us a
little bit of effort triaging.

Fixes golang/go#36749

Change-Id: I2840178afdb4b358f424c28c3e36a6cf5de50dd9
Reviewed-on: https://go-review.googlesource.com/c/build/+/216300
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index 6e26182..18baaa9 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -295,6 +295,7 @@
 	{"label mobile issues", (*gopherbot).labelMobileIssues},
 	{"label documentation issues", (*gopherbot).labelDocumentationIssues},
 	{"label tools issues", (*gopherbot).labelToolsIssues},
+	{"label go.dev issues", (*gopherbot).labelGoDevIssues},
 	{"handle gopls issues", (*gopherbot).handleGoplsIssues},
 	{"close stale WaitingForInfo", (*gopherbot).closeStaleWaitingForInfo},
 	{"cl2issue", (*gopherbot).cl2issue},
@@ -896,6 +897,15 @@
 	})
 }
 
+func (b *gopherbot) labelGoDevIssues(ctx context.Context) error {
+	return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
+		if gi.Closed || gi.PullRequest || !strings.HasPrefix(gi.Title, "go.dev:") || gi.HasLabel("go.dev") || gi.HasEvent("unlabeled") {
+			return nil
+		}
+		return b.addLabel(ctx, gi, "go.dev")
+	})
+}
+
 // handleGoplsIssues labels and asks for additional information on gopls issues.
 //
 // This is necessary because gopls issues often require additional information to diagnose,