cmd/gopherbot: don’t post to CLs in the refs/meta/config branch
Also removes unused b.maxIssueMod field.
Updates golang/go#23865
Change-Id: I4bb3799cbf9f463fa8e99b324f0b2c023422e87e
Reviewed-on: https://go-review.googlesource.com/94615
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index baae780..1080a93 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -17,7 +17,6 @@
"os"
"path/filepath"
"sort"
- "strconv"
"strings"
"time"
@@ -190,9 +189,6 @@
corpus *maintner.Corpus
gorepo *maintner.GitHubRepo
- // maxIssueMod is the latest modification time of all Go
- // github issues. It's updated at the end of the run of tasks.
- maxIssueMod time.Time
knownContributors map[string]bool
}
@@ -238,14 +234,6 @@
}
}
- // Update b.maxIssueMod.
- b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
- if t := gi.LastModified(); t.After(b.maxIssueMod) {
- b.maxIssueMod = t
- }
- return nil
- })
-
return nil
}
@@ -817,6 +805,11 @@
})
})
for email, cl := range cls {
+ // See golang.org/issue/23865
+ if cl.Branch() == "refs/meta/config" {
+ b.knownContributors[email] = true
+ continue
+ }
if cl.Commit == nil || cl.Commit.CommitTime.Before(congratsEpoch) {
b.knownContributors[email] = true
continue
@@ -854,9 +847,9 @@
opts := &gerritCommentOpts{
OldPhrases: congratulatoryMessages,
}
- err := b.addGerritComment(ctx, strconv.Itoa(int(cl.Number)), congratulatoryMessages[0], opts)
+ err := b.addGerritComment(ctx, cl.ChangeID(), congratulatoryMessages[0], opts)
if err != nil {
- return err
+ return fmt.Errorf("could not add comment to golang.org/cl/%d: %v", cl.Number, err)
}
b.knownContributors[email] = true
}