npx claudepluginhub 2389-research/claude-pluginsThis skill uses the workspace's default tool permissions.
<!-- ABOUTME: CI monitoring sub-skill for prbuddy -->
Detects GitHub Actions CI failures in PRs, analyzes logs with gh CLI, fixes code, commits and pushes changes, then re-verifies up to 3 retries until passing.
Diagnoses and fixes GitHub Actions CI failures in pull requests by fetching job logs, identifying root causes like build or test errors, and proposing targeted code changes.
Inspects GitHub PR checks using gh CLI, fetches failing GitHub Actions logs, summarizes root causes, proposes fix plans, and implements code changes after user approval. Ideal for debugging PR CI/CD failures.
Share bugs, ideas, or general feedback.
Monitors CI/workflow status, diagnoses failures, fixes issues, and implements systematic prevention.
Check CI at these moments (not continuously):
gh pr checks --json name,state,bucket,link,workflow
Status interpretation:
bucket: "pass" → Check passedbucket: "fail" → Check failedbucket: "pending" → Still runningbucket: "skipping" → Skippedbucket: "cancel" → CancelledIf all passing:
✓ All CI checks passing (N/N)
Ready for next step.
If pending:
CI checks in progress (N/M complete)
✓ lint (passed)
✓ typecheck (passed)
⏳ test (running)
⏳ build (queued)
Check again:
- Before requesting review
- Before declaring done
If failed: Continue to diagnosis
# Get branch name (with fallback for detached HEAD)
BRANCH=$(git branch --show-current)
if [ -z "$BRANCH" ]; then
BRANCH=$(gh pr view --json headRefName -q .headRefName)
fi
gh run list --branch "$BRANCH" --json databaseId,name,status,conclusion --limit 10
Filter for conclusion: "failure".
For each failed run:
gh run view <run-id> --log-failed
This fetches only the logs for failed steps.
Analyze the logs to identify:
Before fixing, determine if this is a flaky test or real failure:
Signs of flaky test (consider rerun):
Signs of real failure (fix required):
If flaky: Try gh run rerun <id> --failed first. If it fails again, investigate further.
For complex failures, use PAL for expert opinion:
mcp__pal__chat: "CI failure diagnosis:
Error: [error message]
Context: [relevant code/config]
What's the root cause and recommended fix?"
Make the code changes to fix the immediate failure.
Ask: "What would have caught this earlier?"
Prevention hierarchy (prefer higher):
.pre-commit-config.yamlgit add [changed files]
git commit -m "fix: [description]
- Fixed: [acute issue]
- Prevention: [systematic change]"
git push
Report:
Pushed fix. CI will re-run automatically.
Check status: /prbuddy:ci
Or watch in browser: gh pr checks --web
Checking CI status for PR #42...
❌ 1 of 4 checks failed
Failed: test (run 987654321)
Fetching logs...
Error in tests/auth.test.ts:
TypeError: Cannot read property 'email' of undefined
at validateUser (src/auth.ts:45)
Root cause: Missing null check when user object is undefined.
Fixing:
1. Added null check in src/auth.ts:45
2. Added test case for undefined user
3. Prevention: Enabled strictNullChecks in tsconfig.json
Committing...
Pushing...
✓ Fix pushed. Monitor with: /prbuddy:ci
| Task | Command |
|---|---|
| Check status | gh pr checks --json name,state,bucket |
| List runs | gh run list --branch <branch> --json databaseId,name,conclusion |
| View run | gh run view <id> |
| Failed logs | gh run view <id> --log-failed |
| Full logs | gh run view <id> --log |
| Watch run | gh run watch <id> |
| Rerun failed | gh run rerun <id> --failed |
| Rerun all | gh run rerun <id> |