Skip to content

Commit a6a9ae9

Browse files
committed
cmd/gopherbot: ignore GitHub PRs when updating issues
Otherwise you get something like golang/go#23752 (comment) Update golang/go#18517 Change-Id: I5298f1e34738a4f6faa8b829546bf880a237043d Reviewed-on: https://go-review.googlesource.com/93015 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent faa0b51 commit a6a9ae9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cmd/gopherbot/gopherbot.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func (b *gopherbot) addGerritComment(ctx context.Context, changeID, comment stri
380380
func (b *gopherbot) freezeOldIssues(ctx context.Context) error {
381381
tooOld := time.Now().Add(-365 * 24 * time.Hour)
382382
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
383-
if !gi.Closed || gi.Locked {
383+
if !gi.Closed || gi.PullRequest || gi.Locked {
384384
return nil
385385
}
386386
if gi.Updated.After(tooOld) {
@@ -403,7 +403,7 @@ func (b *gopherbot) freezeOldIssues(ctx context.Context) error {
403403
// to get into an edit war with a human.
404404
func (b *gopherbot) labelProposals(ctx context.Context) error {
405405
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
406-
if gi.Closed {
406+
if gi.Closed || gi.PullRequest {
407407
return nil
408408
}
409409
if !strings.HasPrefix(gi.Title, "proposal:") && !strings.HasPrefix(gi.Title, "Proposal:") {
@@ -436,7 +436,7 @@ func (b *gopherbot) labelProposals(ctx context.Context) error {
436436

437437
func (b *gopherbot) setSubrepoMilestones(ctx context.Context) error {
438438
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
439-
if gi.Closed || !gi.Milestone.IsNone() || gi.HasEvent("demilestoned") || gi.HasEvent("milestoned") {
439+
if gi.Closed || gi.PullRequest || !gi.Milestone.IsNone() || gi.HasEvent("demilestoned") || gi.HasEvent("milestoned") {
440440
return nil
441441
}
442442
if !strings.HasPrefix(gi.Title, "x/") {
@@ -480,7 +480,7 @@ func (b *gopherbot) setSubrepoMilestones(ctx context.Context) error {
480480

481481
func (b *gopherbot) setGccgoMilestones(ctx context.Context) error {
482482
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
483-
if gi.Closed || !gi.Milestone.IsNone() || gi.HasEvent("demilestoned") || gi.HasEvent("milestoned") {
483+
if gi.Closed || gi.PullRequest || !gi.Milestone.IsNone() || gi.HasEvent("demilestoned") || gi.HasEvent("milestoned") {
484484
return nil
485485
}
486486
if !strings.Contains(gi.Title, "gccgo") { // TODO: better gccgo bug report heuristic?
@@ -499,7 +499,7 @@ func (b *gopherbot) setGccgoMilestones(ctx context.Context) error {
499499

500500
func (b *gopherbot) labelBuildIssues(ctx context.Context) error {
501501
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
502-
if gi.Closed || !strings.HasPrefix(gi.Title, "x/build") || gi.HasLabel("Builders") || gi.HasEvent("unlabeled") {
502+
if gi.Closed || gi.PullRequest || !strings.HasPrefix(gi.Title, "x/build") || gi.HasLabel("Builders") || gi.HasEvent("unlabeled") {
503503
return nil
504504
}
505505
printIssue("label-builders", gi)
@@ -512,7 +512,7 @@ func (b *gopherbot) labelBuildIssues(ctx context.Context) error {
512512

513513
func (b *gopherbot) labelMobileIssues(ctx context.Context) error {
514514
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
515-
if gi.Closed || !strings.HasPrefix(gi.Title, "x/mobile") || gi.HasLabel("mobile") || gi.HasEvent("unlabeled") {
515+
if gi.Closed || gi.PullRequest || !strings.HasPrefix(gi.Title, "x/mobile") || gi.HasLabel("mobile") || gi.HasEvent("unlabeled") {
516516
return nil
517517
}
518518
printIssue("label-mobile", gi)
@@ -525,7 +525,7 @@ func (b *gopherbot) labelMobileIssues(ctx context.Context) error {
525525

526526
func (b *gopherbot) labelDocumentationIssues(ctx context.Context) error {
527527
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
528-
if gi.Closed || !isDocumentationTitle(gi.Title) || gi.HasLabel("Documentation") || gi.HasEvent("unlabeled") {
528+
if gi.Closed || gi.PullRequest || !isDocumentationTitle(gi.Title) || gi.HasLabel("Documentation") || gi.HasEvent("unlabeled") {
529529
return nil
530530
}
531531
printIssue("label-documentation", gi)
@@ -540,7 +540,7 @@ func (b *gopherbot) closeStaleWaitingForInfo(ctx context.Context) error {
540540
const waitingForInfo = "WaitingForInfo"
541541
now := time.Now()
542542
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
543-
if gi.Closed || !gi.HasLabel("WaitingForInfo") {
543+
if gi.Closed || gi.PullRequest || !gi.HasLabel("WaitingForInfo") {
544544
return nil
545545
}
546546
var waitStart time.Time
@@ -646,7 +646,7 @@ func (b *gopherbot) cl2issue(ctx context.Context) error {
646646
continue
647647
}
648648
gi := ref.Repo.Issue(ref.Number)
649-
if gi == nil || gi.HasLabel(frozenDueToAge) {
649+
if gi == nil || gi.PullRequest || gi.HasLabel(frozenDueToAge) {
650650
continue
651651
}
652652
hasComment := false
@@ -686,7 +686,7 @@ func canonicalLabelName(s string) string {
686686
// but are being renamed to "needs-foo".
687687
func (b *gopherbot) updateNeeds(ctx context.Context) error {
688688
return b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
689-
if gi.Closed {
689+
if gi.Closed || gi.PullRequest {
690690
return nil
691691
}
692692
var numNeeds int

0 commit comments

Comments
 (0)