mcpField

Ship PR Until Green

FeaturedOn demand
Continuous IntegrationUp to 10 rounds

About 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

  1. 01Runs npm test locally every round
  2. 02Reads the check rollup and PR URL via gh pr view
  3. 03Uses gh pr checks as the pass criterion
  4. 04Supports Claude Code and Cursor, up to 10 rounds

Use cases

  1. 01Getting a PR through CI after finishing a feature
  2. 02Unblocking a PR stuck on failing checks
  3. 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.

prompt.md
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.

01
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
02
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
03
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.

Not met → next roundExits when met

Supported agents

Coding agents that can run this loop directly.

Claude Code
Cursor
Codex

Comments

Markdown supported