Skip to content

Commit

Permalink
cmd/gopherbot: don't consider reopened issues in close-cherry-pick task
Browse files Browse the repository at this point in the history
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 <bradfitz@golang.org>
  • Loading branch information
dmitshur committed Jan 7, 2019
1 parent 03ea096 commit 6a02381
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/gopherbot/gopherbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -1360,13 +1360,13 @@ func (b *gopherbot) getMinorMilestoneForMajor(ctx context.Context, majorRel stri
// closeCherryPickIssues closes cherry-pick issues when CLs are merged to
// release branches, as GitHub only does that on merge to master.
func (b *gopherbot) closeCherryPickIssues(ctx context.Context) error {
openCherryPickIssues := make(map[int32]*maintner.GitHubIssue) // by GitHub Issue Number
cherryPickIssues := make(map[int32]*maintner.GitHubIssue) // by GitHub Issue Number
b.gorepo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
if gi.Closed || gi.PullRequest || gi.NotExist || gi.Milestone.IsNone() {
if gi.Closed || gi.PullRequest || gi.NotExist || gi.Milestone.IsNone() || gi.HasEvent("reopened") {
return nil
}
if strings.Count(gi.Milestone.Title, ".") == 2 { // minor release
openCherryPickIssues[gi.Number] = gi
cherryPickIssues[gi.Number] = gi
}
return nil
})
Expand All @@ -1388,7 +1388,7 @@ func (b *gopherbot) closeCherryPickIssues(ctx context.Context) error {
if id := ref.Repo.ID(); id.Owner != "golang" || id.Repo != "go" {
continue
}
gi, ok := openCherryPickIssues[ref.Number]
gi, ok := cherryPickIssues[ref.Number]
if !ok {
continue
}
Expand Down

0 comments on commit 6a02381

Please sign in to comment.