Orchestrate a GitHub PR from first push to merge-ready in a single pass: run ci-fix-loop until all checks are green, detect active AI review bots (Qodo, CodeRabbit), run their fix loops in sequence until zero unresolved threads remain, then confirm the PR is merge-ready. Use when the user says "drive this PR to green", "make this merge-ready", "ship this branch", or wants CI and review comments handled end to end without babysitting each loop separately.
Installs into .claude/skills of the current project.
Are you the author of Pr To Green?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/oleg-koval-pr-to-green-agent-skills)
---
name: pr-to-green
description: >
Orchestrate a GitHub PR from first push to merge-ready in a single pass: run ci-fix-loop until
all checks are green, detect active AI review bots (Qodo, CodeRabbit), run their fix loops in
sequence until zero unresolved threads remain, then confirm the PR is merge-ready. Use when the
user says "drive this PR to green", "make this merge-ready", "ship this branch", or wants CI and
review comments handled end to end without babysitting each loop separately.
license: MIT
allowed-tools: Bash, Read, Write, Edit
compatibility: Codex, Claude Code, Cursor, GitHub Copilot, Windsurf, Kiro, and other Agent Skills compatible tools. Requires git and gh (GitHub CLI) authenticated, with GitHub Actions configured.
metadata:
targets: [_source-only]
author: Oleg Koval
tags:
- github
- pr
- ci
- loop
- qodoloop
- coderabbitloop
- ci-fix-loop
- workflow
- automation
source: weekly-pattern-learner
source_reason: "ci-fix-loop, coderabbitloop, and qodoloop all exist independently: no skill orchestrates them into a single end-to-end 'drive PR to green' pass"
source_date: "2026-07-31"
---
> π€ *Auto-generated by **weekly-pattern-learner** Β· ci-fix-loop, coderabbitloop, and qodoloop all exist independently: no skill orchestrates them into a single end-to-end 'drive PR to green' pass*
# PR to Green
Drive a GitHub PR from first push to fully merge-ready: CI checks green, every active AI
review bot addressed, zero unresolved threads.
## Inputs
- **PR number** (optional): detect from current branch if not given.
- **Max total iterations** (optional, default: 10): across all loops combined.
- **Skip bots** (optional): `--skip-qodo`, `--skip-coderabbit` to limit which review loops run.
## Phase 1: Ensure the PR exists
```bash
gh pr view --json number,headRefName,state 2>/dev/null
```
If no open PR exists, run `olko:pr-description-writer` first to create one, then continue.
## Phase 2: CI fix loop
Run `olko:ci-fix-loop` until all required checks pass, or a blocker needs a human.
Check current state first:
```bash
gh pr checks --json name,state,conclusion \
--jq '.[] | select(.conclusion != "success" and .conclusion != "skipped")'
```
If all checks already pass, skip to Phase 3. Otherwise run `olko:ci-fix-loop`.
**Stop entirely if ci-fix-loop returns `blocked`**: do not run review loops while CI is red,
as bots may refuse to review a failing branch and their feedback will shift after fixes land.
## Phase 3: Detect active review bots
```bash
# Check if Qodo has posted on this PR
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews \
--jq '[.[] | select(.user.login == "qodo-code-review[bot]")] | length'
# Check if CodeRabbit has posted
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews \
--jq '[.[] | select(.user.login == "coderabbitai[bot]")] | length'
```
If neither has reviewed yet, nudge both and wait:
```bash
gh pr comment <PR_NUMBER> --body "@coderabbitai review"
gh pr comment <PR_NUMBER> --body "@qodo-code-review review"
```
Poll (every ~15s, timeout ~5min) for a review from either bot. If neither responds, proceed
without a review-bot loop and note it in the report.
## Phase 4: Review bot loops
Run each detected loop to completion before starting the next.
**Order:** qodoloop first (actionability-first bot, stricter on must-fix findings), then
coderabbitloop (thoroughness-first, may surface additional style or security hints after Qodo's
fixes change the diff context).
### Qodo
If Qodo posted at least one review: run `olko:qodoloop`.
It handles fetching unresolved threads, reading each Agent Prompt block, applying the fix,
replying to the thread, resolving it, pushing, and polling for the next Qodo review.
If qodoloop returns rate-limited, note it and continue to CodeRabbit without stopping.
### CodeRabbit
If CodeRabbit posted at least one review: run `olko:coderabbitloop`.
Same structure: fetch unresolved threads, read `π€ Prompt for AI Agents` blocks, fix, reply,
resolve, push, wait for the next CodeRabbit review.
If coderabbitloop returns rate-limited, record it in the report and stop.
## Phase 5: Final verification
Confirm the PR is truly merge-ready before reporting success:
```bash
# Required checks all green?
gh pr checks --json name,state,conclusion \
--jq '[.[] | select(.conclusion != "success" and .conclusion != "skipped")] | length'
# Any unresolved review threads?
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes { isResolved }
}
}
}
}
' -f owner="{owner}" -f repo="{repo}" -F number=<PR_NUMBER> \
--jq '.data.repository.pullRequest.reviewThreads.nodes | map(select(.isResolved == false)) | length'
```
If either count > 0, identify what remains and report specifically: do not claim the PR is
green when it is not.
## Report
```
PR-to-green complete.
CI: β all checks green (2 fix iterations)
Qodo: β 4 findings fixed, 0 unresolved
CodeRabbit: β 6 findings fixed, 0 unresolved
Blockers: none
Status: merge-ready β
OR
CI: β green
Qodo: β 2 findings fixed
CodeRabbit: β rate-limited, 1 finding still open (re-run tomorrow)
Status: partial: CodeRabbit quota exhausted, human review needed
```
## Chaining
| Before this skill | After this skill |
|---|---|
| `olko:git-commit` + push | `gh pr merge` |
| `olko:pr-description-writer` | merge or stakeholder review |