
PR Check Loop
FreeEnsure GitHub PR checks are green or identify blockers.
Free · Opens the source repo
What PR Check Loop does
PR Check Loop is a bash-based skill designed specifically for managing GitHub pull requests (PRs) by iterating through the checks until they are green or a specific blocker is identified. This skill is particularly useful for developers who frequently encounter failing or pending checks after making updates to their PRs. By automating the process of checking the status of CI checks and addressing any issues, PR Check Loop helps maintain a smoother workflow and reduces the time spent manually resolving PR check failures.
The skill operates by first identifying the relevant PR, either by using a provided PR number or detecting it from the current branch. It then focuses on the latest commit's checks, ensuring that only the most recent changes are considered. The skill polls for check statuses and waits for them to complete, categorizing them into success, pending, or failure states. If any checks fail, the skill provides a structured approach to investigate these failures, guiding the user through actionable steps to resolve them.
Once a fix is made, the skill pushes the changes and repeats the process, continuing until all checks are green or a specified maximum number of iterations is reached. If a blocker remains, it provides a detailed report that includes the PR URL, the latest commit SHA, and specific failing checks, allowing for efficient escalation to the appropriate team members. This targeted approach not only saves time but also facilitates better communication regarding PR issues.
PR Check Loop is ideal for developers working in teams that rely heavily on CI/CD pipelines and need to ensure that their code is always in a deployable state. It is particularly beneficial in scenarios where multiple checks are involved, and manual tracking would be cumbersome. However, it is not suitable for GitLab repositories, as it is specifically tailored for GitHub PRs. Users looking for broader PR management features, such as review comment cleanup, should consider using it in conjunction with other tools like check-pr.
Overall, PR Check Loop streamlines the process of getting PRs ready for merging, allowing developers to focus on writing code rather than managing check statuses.
When to use it
Use PR Check Loop when you need to ensure that a GitHub PR reaches a fully green check state after making updates or fixes.
When not to use it
Do not use this skill for GitLab repositories, as it is specifically designed for GitHub. It also does not handle review comments or PR template issues.
What you can build with it
Automating CI Checks
Use PR Check Loop to automatically iterate through CI checks on your GitHub PR, ensuring they are all green before merging.
Identifying Blockers
When a PR is stuck due to failing checks, PR Check Loop helps identify specific blockers to facilitate faster resolution.
Streamlining PR Management
Integrate PR Check Loop into your workflow to reduce the manual effort involved in managing PR check statuses.
How to install PR Check Loop
View source1. Install with the skills CLI
npx skills add paperclipai/paperclip/prcheckloop --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by paperclipaiPRCheckloop
Get a GitHub PR to a fully green check state, or exit with a concrete blocker.
Scope
- GitHub PRs only. If the repo is GitLab, stop and use
check-pr. - Focus on checks for the latest PR head SHA, not old commits.
- Focus on CI/status checks, not review comments or PR template cleanup.
- If the user also wants review-comment cleanup, pair this with
check-pr.
Inputs
- PR number (optional): If not provided, detect the PR for the current branch.
- Max iterations: default
5.
Workflow
1. Identify the PR
If no PR number is provided, detect it from the current branch:
gh pr view --json number,headRefName,headRefOid,url,isDraft
If needed, switch to the PR branch before making changes.
Stop early if:
ghis not authenticated- there is no PR for the branch
- the repo is not hosted on GitHub
2. Track the latest head SHA
Always work against the current PR head SHA:
PR_JSON=$(gh pr view "$PR_NUMBER" --json number,headRefName,headRefOid,url)
HEAD_SHA=$(echo "$PR_JSON" | jq -r .headRefOid)
PR_URL=$(echo "$PR_JSON" | jq -r .url)
Ignore failing checks from older SHAs. After every push, refresh HEAD_SHA and
restart the inspection loop.
3. Inventory checks for that SHA
Fetch both GitHub check runs and legacy commit status contexts:
gh api "repos/{owner}/{repo}/commits/$HEAD_SHA/check-runs?per_page=100"
gh api "repos/{owner}/{repo}/commits/$HEAD_SHA/status"
For a compact PR-level view, this GraphQL payload is useful:
gh api graphql -f query='
query($owner:String!, $repo:String!, $pr:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$pr) {
headRefOid
url
statusCheckRollup {
contexts(first:100) {
nodes {
__typename
... on CheckRun { name status conclusion detailsUrl workflowName }
... on StatusContext { context state targetUrl description }
}
}
}
}
}
}' -F owner=OWNER -F repo=REPO -F pr="$PR_NUMBER"
4. Wait for checks to actually run
After a new push, checks can take a moment to appear. Poll every 15-30 seconds until one of these is true:
- checks have appeared and every item is in a terminal state
- checks have appeared and at least one failed
- no checks appear after a reasonable wait, usually 2 minutes
Treat these as terminal success states:
- check runs:
SUCCESS,NEUTRAL,SKIPPED - status contexts:
SUCCESS
Treat these as pending:
- check runs:
QUEUED,PENDING,WAITING,REQUESTED,IN_PROGRESS - status contexts:
PENDING
Treat these as failures:
- check runs:
FAILURE,TIMED_OUT,CANCELLED,ACTION_REQUIRED,STARTUP_FAILURE,STALE - status contexts:
FAILURE,ERROR
If no checks appear for the latest SHA, inspect .github/workflows/, workflow
path filters, and branch protection expectations. If the missing check cannot be
caused or fixed from the repo, escalate.
5. Investigate failing checks
For GitHub Actions failures, inspect runs and failed logs for the current SHA:
gh run list --commit "$HEAD_SHA" --json databaseId,workflowName,status,conclusion,url,headSha
gh run view <RUN_ID> --json databaseId,name,workflowName,status,conclusion,jobs,url,headSha
gh run view <RUN_ID> --log-failed
For each failing check, classify it:
| Failure type | Action |
|---|---|
| Code/test regression | Reproduce locally, fix, and verify |
| Lint/type/build mismatch | Run the matching local command from the workflow and fix it |
| Flake or transient infra issue | Rerun once if evidence supports flakiness |
| External service/status app failure | Escalate with the details URL and owner guess |
| Missing secret/permission/branch protection issue | Escalate immediately |
Only rerun a failed job once without code changes. Do not loop on reruns.
6. Fix actionable failures
If the failure is actionable from the checked-out code:
- Read the workflow or failing command to identify the real gate.
- Reproduce locally where reasonable.
- Make the smallest correct fix.
- Run focused verification first, then broader verification if needed.
- Commit in a logical commit.
- Push before re-checking the PR.
Do not stop at a local fix. The loop is only complete when the remote PR checks for the new head SHA are green.
7. Push and repeat
After each fix:
git push
sleep 5
Then refresh the PR metadata, get the new HEAD_SHA, and restart from Step 3.
Exit the loop only when:
- all checks for the latest head SHA are green, or
- a blocker remains after reasonable repair effort, or
- the max iteration count is reached
8. Escalate blockers precisely
If you cannot get the PR green, report:
- PR URL
- latest head SHA
- exact failing or missing check names
- details URLs
- what you already tried
- why it is blocked
- who should likely unblock it
- the next concrete action
Good blocker examples:
- external status app outage
- missing GitHub secret or permission
- required check name mismatch in branch protection
- persistent flake after one rerun
- failure needs credentials or infrastructure access you do not have
Output
When the skill completes, report:
- PR URL and branch
- final head SHA
- green/pending/failing check summary
- fixes made and verification run
- whether changes were pushed
- blocker summary if not fully green
Notes
- This skill is intentionally narrower than
check-pr: it is a repair loop for PR checks. - This skill complements
greploop: Greptile can be perfect while CI is still red.
Frequently asked questions about PR Check Loop
Similar skills
Turborepo
Optimized build system for JavaScript/TypeScript monorepos.
Azure Pipelines Validation
Streamline your Azure DevOps pipeline changes locally.
Azure Developer CLI
Streamline your Azure project workflows with best practices.
Azure Container Registry CLI
Manage Azure Container Registry resources with ease.
Aspire
Build and orchestrate polyglot distributed applications seamlessly.
Vercel CLI
Manage and deploy Vercel projects from the command line.
