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>
This commit is contained in:
Andrew Bonventre 2017-12-11 14:07:38 -05:00
Родитель 50452d7bf4
Коммит 92d565a7cf
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -122,7 +122,7 @@ func (s *server) corpusUpdateLoop(ctx context.Context) {
const (
issuesURLBase = "https://golang.org/issue/"
labelHelpWanted = "HelpWanted"
labelHelpWantedID = 150880243
)
func (s *server) updateHelpWantedIssues() {
@ -134,7 +134,7 @@ func (s *server) updateHelpWantedIssues() {
if i.Closed {
return nil
}
if i.HasLabel(labelHelpWanted) {
if i.HasLabelID(labelHelpWantedID) {
ids = append(ids, i.Number)
}
return nil

Просмотреть файл

@ -333,6 +333,12 @@ func (gi *GitHubIssue) HasLabel(label string) bool {
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{}