devapp,maintner: use ID instead of text for HelpWanted label
Add *GitHubIssue.HasLabelID method to maintner API.
Since the text will change to “help wanted”, adjust the logic to
make it a bit more future-proof.
Updates golang/go#22329
Change-Id: I22e9f06d6e2aca8ae4da31532f9cde2317a709ff
Reviewed-on: https://go-review.googlesource.com/83297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/devapp/server.go b/devapp/server.go
index 6b62213..e0b4974 100644
--- a/devapp/server.go
+++ b/devapp/server.go
@@ -122,7 +122,7 @@
const (
issuesURLBase = "https://golang.org/issue/"
- labelHelpWanted = "HelpWanted"
+ labelHelpWantedID = 150880243
)
func (s *server) updateHelpWantedIssues() {
@@ -134,7 +134,7 @@
if i.Closed {
return nil
}
- if i.HasLabel(labelHelpWanted) {
+ if i.HasLabelID(labelHelpWantedID) {
ids = append(ids, i.Number)
}
return nil
diff --git a/maintner/github.go b/maintner/github.go
index 30f29c5..82a8451 100644
--- a/maintner/github.go
+++ b/maintner/github.go
@@ -333,6 +333,12 @@
return false
}
+// HasLabelID returns whether the issue has a label with the given ID.
+func (gi *GitHubIssue) HasLabelID(id int64) bool {
+ _, ok := gi.Labels[id]
+ return ok
+}
+
func (gi *GitHubIssue) getCreatedAt() time.Time {
if gi == nil {
return time.Time{}