cmd/gerritbot: use the new repos package for repo policy
The only behavior change is that "gofrontend" is now included, which
is arguably a bug fix (an example of our various lists of repos
getting out of sync). At least, I don't recall any discussion of
omitting that repo. Ian +1'd this CL, so keeping them on.
If we want to exclude a repo from gerritbot in the future we'll need
to add some policy fields/methods to the repos package.
Updates golang/go#36047
Change-Id: I877cd3b6c292ac888863523e05799208e247499f
Reviewed-on: https://go-review.googlesource.com/c/build/+/210741
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/cmd/gerritbot/gerritbot.go b/cmd/gerritbot/gerritbot.go
index f7485d8..e1273f0 100644
--- a/cmd/gerritbot/gerritbot.go
+++ b/cmd/gerritbot/gerritbot.go
@@ -32,6 +32,7 @@
"golang.org/x/build/internal/https"
"golang.org/x/build/maintner"
"golang.org/x/build/maintner/godata"
+ "golang.org/x/build/repos"
"golang.org/x/oauth2"
)
@@ -189,43 +190,16 @@
)
// Gerrit projects we accept PRs for.
-var gerritProjectWhitelist = map[string]bool{
- "arch": true,
- "benchmarks": true,
- "blog": true,
- "build": true,
- "crypto": true,
- "debug": true,
- "dl": true,
- "example": true,
- "exp": true,
- "gddo": true,
- "go": true,
- "image": true,
- "lint": true,
- "mobile": true,
- "mod": true,
- "net": true,
- "oauth2": true,
- "perf": true,
- "playground": true,
- "proposal": true,
- "protobuf": true,
- "review": true,
- "scratch": true,
- "sublime-build": true,
- "sublime-config": true,
- "sync": true,
- "sys": true,
- "talks": true,
- "term": true,
- "text": true,
- "time": true,
- "tools": true,
- "tour": true,
- "vgo": true,
- "website": true,
- "xerrors": true,
+var gerritProjectWhitelist = genProjectWhitelist()
+
+func genProjectWhitelist() map[string]bool {
+ m := make(map[string]bool)
+ for p, r := range repos.ByGerritProject {
+ if r.MirrorToGitHub {
+ m[p] = true
+ }
+ }
+ return m
}
type cachedPullRequest struct {