Skip to content

ci: Add workflow to close resolved reproduction PRs#30

Open
dingsdax wants to merge 4 commits intomainfrom
add-close-resolved-repros-workflow
Open

ci: Add workflow to close resolved reproduction PRs#30
dingsdax wants to merge 4 commits intomainfrom
add-close-resolved-repros-workflow

Conversation

@dingsdax
Copy link
Contributor

@dingsdax dingsdax commented Mar 3, 2026

Summary

  • Adds a daily GitHub Actions workflow (close-resolved-repros.yml) that automatically closes reproduction PRs whose upstream issue has been resolved
  • Labels closed PRs with resolved-upstream so they're distinguishable from manually closed PRs
  • Includes a dry_run input for safe manual testing via workflow_dispatch

How it works

  1. Fetches all open PRs matching the Reproduction for sentry-{repo}#{number} title format
  2. Checks the upstream issue state in getsentry/{repo} via the GitHub API
  3. If closed: labels resolved-upstream, posts a comment, and closes the PR
  4. Skips already-labelled PRs to avoid duplicate processing

Dry run results

If run today, would close 4 PRs:

Test plan

  • Trigger workflow manually with dry_run: true and verify log output
  • Trigger workflow manually with dry_run: false and verify PRs are labelled, commented, and closed

🤖 Generated with Claude Code

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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Create PR

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],
+              });
             }
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@dingsdax dingsdax requested review from sl0thentr0py March 3, 2026 13:06
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>
dingsdax and others added 2 commits March 3, 2026 14:34
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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}`);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant