agentleFS
jaskirat1616jaskirat1616/grok-skills/skills/pr-to-green/SKILL.md

pr-to-green

Skill22 starsChanged 3 months agoMITView on GitHub

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.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If no open PR exists, run olko:pr-description-writer first to create one, then continue.

    line 49
  2. Very specific:

    Run olko:ci-fix-loop until all required checks pass, or a blocker needs a human.

    line 53
  3. Distinctive:

    Check current state first:

    line 55
  4. Very specific:

    If all checks already pass, skip to Phase 3.

    line 62
  5. Very specific:

    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 …

    line 64
  6. Distinctive:

    If neither has reviewed yet, nudge both and wait:

    line 79
  7. Distinctive:

    Run each detected loop to completion before starting the next.

    line 91
  8. Very specific:

    If Qodo posted at least one review: run olko:qodoloop.

    line 99
  9. Distinctive:

    If qodoloop returns rate-limited, note it and continue to CodeRabbit without stopping.

    line 104
  10. Very specific:

    If CodeRabbit posted at least one review: run olko:coderabbitloop.

    line 108
  11. Distinctive:

    If coderabbitloop returns rate-limited, record it in the report and stop.

    line 113
  12. Distinctive:

    If either count > 0, identify what remains and report specifically: do not claim the PR is green when it is not.

    line 139

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🤖 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

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:

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

# 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:

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:

# 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 skillAfter this skill
olko:git-commit + pushgh pr merge
olko:pr-description-writermerge or stakeholder review

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.