cmd/gopherbot: handle gone issues in closeGitHubIssue too Similarly to how it was done for setMilestone in CL 593056. This fixes new instances of the same problem that gopherbot ran into as part of the "close stale watchflakes issues" task: 2026/10/29 18:58:37 close stale watchflakes issues: b.closeGitHubIssue(_, golang/go, 58080) = PATCH https://api.github.com/repos/golang/go/issues/58080: 410 This issue was deleted [] 2026/10/29 18:58:37 gopherbot ran in 1m38.117117564s 2026/10/29 18:58:37 sleeping 30s after previous error. For golang/go#30184. Change-Id: I317c145283901cc095308f22136b65a6e49be88e Reviewed-on: https://go-review.googlesource.com/c/build/+/856361 Reviewed-by: PJ Malloy <pjmalloy@google.com> Reviewed-by: t hepudds <thepudds1460@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index 20122a4..8715b75 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go
@@ -368,6 +368,8 @@ {goRepo, 45201}: true, {goRepo, 45202}: true, {goRepo, 47140}: true, + {goRepo, 58080}: true, + {goRepo, 58091}: true, {goRepo, 62987}: true, {goRepo, 67913}: true, @@ -790,10 +792,16 @@ log.Printf("[dry-run] would close go.dev/issue/%v%s", number, suffix) return nil } - _, _, err := b.ghc.Issues.Edit(ctx, repoID.Owner, repoID.Repo, int(number), &github.IssueRequest{ + _, resp, err := b.ghc.Issues.Edit(ctx, repoID.Owner, repoID.Repo, int(number), &github.IssueRequest{ State: new("closed"), StateReason: reason, }) + if err != nil && resp != nil && (resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusGone) { + // An issue can become gone on GitHub without maintner realizing it. See go.dev/issue/30184. + log.Printf("closeGitHubIssue: Issue %v#%v returned %s when trying to close issue. Skipping. See go.dev/issue/30184.", repoID, number, resp.Status) + b.deletedIssues[githubIssue{repoID, number}] = true + return nil + } return err }