Skip to content

feat(iterate-pr): Auto-trigger review bots on draft PRs#100

Draft
vaind wants to merge 2 commits intomainfrom
feat/iterate-pr-trigger-review-bots
Draft

feat(iterate-pr): Auto-trigger review bots on draft PRs#100
vaind wants to merge 2 commits intomainfrom
feat/iterate-pr-trigger-review-bots

Conversation

@vaind
Copy link
Contributor

@vaind vaind commented Mar 18, 2026

Summary

  • Adds trigger_review_bots.py script that detects and triggers review bots on draft PRs
  • Updates workflow to run the script at startup (step 2) and after each push (step 7)

Why

Review bots (cursor, sentry) don't auto-run on draft PRs. Users have to manually post @cursor review / @sentry review after every push. This automates it by:

  1. Detecting which bots are active — scans review/comment authors from the last 10 merged PRs via a single GraphQL query
  2. Triggering them — posts the appropriate trigger comment for each detected bot
  3. Cleaning up — minimizes (hides as outdated) previous trigger comments before posting new ones so the PR conversation stays clean

Uses a hardcoded trigger map (cursor@cursor review, sentry@sentry review) that's easy to extend.

Test plan

  • Run on a draft PR in a repo with cursor/sentry bots — should detect and trigger both
  • Run on a non-draft PR — should exit early with is_draft: false
  • Run twice on same draft PR — previous trigger comments should be minimized before new ones are posted
  • Run on a repo with no known bots — should return no_bots_found: true

🤖 Generated with Claude Code

vaind and others added 2 commits March 18, 2026 14:51
Review bots (cursor, sentry, etc.) don't auto-run on draft PRs,
requiring manual "@botName review" comments after each push. This
adds a trigger_review_bots.py script that:

- Detects active review bots by scanning review/comment authors
  from the last 10 merged PRs via a single GraphQL query
- Posts trigger comments only on draft PRs (exits early otherwise)
- Minimizes previous trigger comments before posting new ones
  to keep the PR conversation clean
- Uses a hardcoded trigger map (extensible) for known Sentry bots

The workflow is updated to run the script both at startup (step 2)
and after each push (step 7).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Eliminate duplicated subprocess.run boilerplate by reusing the
existing run_gh() helper for GraphQL and REST API calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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