Skip to content

Commit 6a02381

Browse files
committed
cmd/gopherbot: don't consider reopened issues in close-cherry-pick task
gopherbot isn't supposed to fight humans. If someone has re-opened a cherry-pick issue, don't try to close it again. Rename openCherryPickIssues to cherryPickIssues, to better reflect that it's the set of candidate cherry-pick issues to close, not all open ones. Fixes golang/go#29270 Change-Id: I2b0ae9bd9849e72f7f04b208919735451c1f4593 Reviewed-on: https://go-review.googlesource.com/c/154337 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 03ea096 commit 6a02381

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/gopherbot/gopherbot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,13 +1360,13 @@ func (b *gopherbot) getMinorMilestoneForMajor(ctx context.Context, majorRel stri
13601360
// closeCherryPickIssues closes cherry-pick issues when CLs are merged to
13611361
// release branches, as GitHub only does that on merge to master.
13621362
func (b *gopherbot) closeCherryPickIssues(ctx context.Context) error {
1363-
openCherryPickIssues := make(map[int32]*maintner.GitHubIssue) // by GitHub Issue Number
1363+
cherryPickIssues := make(map[int32]*maintner.GitHubIssue) // by GitHub Issue Number
13641364
b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
1365-
if gi.Closed || gi.PullRequest || gi.NotExist || gi.Milestone.IsNone() {
1365+
if gi.Closed || gi.PullRequest || gi.NotExist || gi.Milestone.IsNone() || gi.HasEvent("reopened") {
13661366
return nil
13671367
}
13681368
if strings.Count(gi.Milestone.Title, ".") == 2 { // minor release
1369-
openCherryPickIssues[gi.Number] = gi
1369+
cherryPickIssues[gi.Number] = gi
13701370
}
13711371
return nil
13721372
})
@@ -1388,7 +1388,7 @@ func (b *gopherbot) closeCherryPickIssues(ctx context.Context) error {
13881388
if id := ref.Repo.ID(); id.Owner != "golang" || id.Repo != "go" {
13891389
continue
13901390
}
1391-
gi, ok := openCherryPickIssues[ref.Number]
1391+
gi, ok := cherryPickIssues[ref.Number]
13921392
if !ok {
13931393
continue
13941394
}

0 commit comments

Comments
 (0)