ci: Add workflow to close resolved reproduction PRs#30
ci: Add workflow to close resolved reproduction PRs#30
Conversation
Runs daily at 9am UTC (and manually via workflow_dispatch). For each
open PR matching the "Reproduction for sentry-{repo}#{number}" title
format, checks whether the upstream issue in getsentry/{repo} is
closed. If so, labels the PR as resolved-upstream, posts a comment,
and closes it. Includes a dry_run input for safe manual testing.
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Label-before-close ordering prevents retry on partial failure
- Reordered the workflow to apply the resolved-upstream label only after successfully closing the PR so failed closes are retried on subsequent runs.
Or push these changes by commenting:
@cursor push 86560eceea
Preview (86560eceea)
diff --git a/.github/workflows/close-resolved-repros.yml b/.github/workflows/close-resolved-repros.yml
--- a/.github/workflows/close-resolved-repros.yml
+++ b/.github/workflows/close-resolved-repros.yml
@@ -70,13 +70,6 @@
continue;
}
- await github.rest.issues.addLabels({
- owner,
- repo,
- issue_number: pr.number,
- labels: [label],
- });
-
await github.rest.issues.createComment({
owner,
repo,
@@ -94,4 +87,11 @@
pull_number: pr.number,
state: 'closed',
});
+
+ await github.rest.issues.addLabels({
+ owner,
+ repo,
+ issue_number: pr.number,
+ labels: [label],
+ });
}If the close call fails, the PR stays unlabelled so the next scheduled run will retry instead of skipping it permanently. Co-Authored-By: Claude <noreply@anthropic.com>
Skip issues closed as duplicate or not_planned since the bug may still exist elsewhere. Only act on state_reason: completed. Co-Authored-By: Claude <noreply@anthropic.com>
A failure on one PR (e.g. addLabels) no longer crashes the loop and skips remaining PRs. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| }); | ||
| } catch (err) { | ||
| core.warning(`PR #${pr.number}: failed to close — ${err.message}`); | ||
| } |
There was a problem hiding this comment.
Partial failure leaves PR closed without label permanently
Low Severity
The close, comment, and label API calls are wrapped in a single try/catch. If pulls.update (close) succeeds but createComment or addLabels throws, the PR ends up closed without the resolved-upstream label. Since subsequent runs only fetch open PRs via state: 'open', this PR will never be retried, and the label — described as key for distinguishing these from manually closed PRs — is permanently lost. Separate try/catch blocks for the comment and label calls after the close would allow those operations to be attempted independently.



Summary
close-resolved-repros.yml) that automatically closes reproduction PRs whose upstream issue has been resolvedresolved-upstreamso they're distinguishable from manually closed PRsdry_runinput for safe manual testing via workflow_dispatchHow it works
Reproduction for sentry-{repo}#{number}title formatgetsentry/{repo}via the GitHub APIresolved-upstream, posts a comment, and closes the PRDry run results
If run today, would close 4 PRs:
sentry-javascript#19580sentry-javascript#19014sentry-javascript#19013sentry-php#1999Test plan
dry_run: trueand verify log outputdry_run: falseand verify PRs are labelled, commented, and closed🤖 Generated with Claude Code