Ship PR Until Green
FeaturedOn demandAbout Ship PR Until Green
This loop is started manually. In each round the coding agent implements changes and runs tests, then opens or updates the PR and reads its check status. It runs for up to 10 rounds, until gh pr checks shows every check as success.
Key features
- 01Runs npm test locally every round
- 02Reads the check rollup and PR URL via gh pr view
- 03Uses gh pr checks as the pass criterion
- 04Supports Claude Code and Cursor, up to 10 rounds
Use cases
- 01Getting a PR through CI after finishing a feature
- 02Unblocking a PR stuck on failing checks
- 03Changes that need repeated adjustment until the pipeline is green
- Goal
- A PR is open and all of its CI checks pass.
- Exit when
- Stop when every PR check has the status success.
- Between iterations run
- gh pr checks
Launch prompt
Paste into Claude Code / Cursor. The agent repeats the steps below until the exit condition is met.
Start the "Ship PR Until Green" loop. Goal: A PR is open and all of its CI checks pass. Max iterations: 10. Step 1: Implement and test locally — Change the code based on failures from the previous round, then run npm test. If local tests fail, fix them before moving on. `npm test` Step 2: Open or update the PR — Commit and push the changes, open or update the PR, then use gh pr view to read the check rollup and the PR URL. `gh pr view --json statusCheckRollup,url` Step 3: Review CI results — Run gh pr checks to judge the outcome. If all checks are success, finish; otherwise note the failing or pending ones and start the next round. Between iterations run: `gh pr checks` Exit when: Stop when every PR check has the status success.
Steps
Each round runs in order; if the exit condition isn’t met, another round starts, up to 10.
Change the code based on failures from the previous round, then run npm test. If local tests fail, fix them before moving on.
npm testCommit and push the changes, open or update the PR, then use gh pr view to read the check rollup and the PR URL.
gh pr view --json statusCheckRollup,urlRun gh pr checks to judge the outcome. If all checks are success, finish; otherwise note the failing or pending ones and start the next round.
Supported agents
Coding agents that can run this loop directly.