Iterate on PR Until CI Passes
Continuously iterate on the current branch until all CI checks pass and review feedback is addressed.
Requires: GitHub CLI (
) authenticated.
Important: All scripts must be run from the repository root directory (where
is located), not from the skill directory. Use the full path to the script via
.
Bundled Scripts
scripts/fetch_pr_checks.py
Fetches CI check status and extracts failure snippets from logs.
bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py [--pr NUMBER]
Returns JSON:
json
{
"pr": {"number": 123, "branch": "feat/foo"},
"summary": {"total": 5, "passed": 3, "failed": 2, "pending": 0},
"checks": [
{"name": "tests", "status": "fail", "log_snippet": "...", "run_id": 123},
{"name": "lint", "status": "pass"}
]
}
scripts/fetch_pr_feedback.py
Fetches and categorizes PR review feedback using the
LOGAF scale.
bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py [--pr NUMBER]
Returns JSON with feedback categorized as:
- - Must address before merge (, blocker, changes requested)
- - Should address (, standard feedback)
- - Optional (, nit, style, suggestion)
- - Automated comments (Codecov, Sentry, etc.)
- - Already resolved threads
Workflow
1. Identify PR
bash
gh pr view --json number,url,headRefName
Stop if no PR exists for the current branch.
2. Check CI Status
Run
${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py
to get structured failure data.
Wait if pending: If bot-related checks (sentry, codecov, cursor, bugbot, seer) are still running, wait before proceeding—they may post additional feedback.
3. Fix CI Failures
For each failure in the script output:
- Read the to understand the failure
- Read the relevant code before making changes
- Fix the issue with minimal, targeted changes
Do NOT assume what failed based on check name alone—always read the logs.
4. Gather Review Feedback
Run
${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py
to get categorized feedback.
5. Handle Feedback by LOGAF Priority
Auto-fix (no prompt):
- - must address (blockers, security, changes requested)
- - should address (standard feedback)
Prompt user for selection:
- - present numbered list and ask which to address:
Found 3 low-priority suggestions:
1. [l] "Consider renaming this variable" - @reviewer in api.py:42
2. [nit] "Could use a list comprehension" - @reviewer in utils.py:18
3. [style] "Add a docstring" - @reviewer in models.py:55
Which would you like to address? (e.g., "1,3" or "all" or "none")
Skip silently:
- threads
- comments (informational only)
6. Commit and Push
bash
git add <files>
git commit -m "fix: <descriptive message>"
git push
7. Wait for CI
bash
gh pr checks --watch --interval 30
8. Repeat
Return to step 2 if CI failed or new feedback appeared.
Exit Conditions
Success: All checks pass, no unaddressed high/medium feedback, user has decided on low-priority items.
Ask for help: Same failure after 3 attempts, feedback needs clarification, infrastructure issues.
Stop: No PR exists, branch needs rebase.
Fallback
If scripts fail, use
CLI directly:
gh pr checks --json name,state,bucket,link
gh run view <run-id> --log-failed
gh api repos/{owner}/{repo}/pulls/{number}/comments