CI Watch
Let:
Φ := ${CLAUDE_PLUGIN_ROOT}
SCR := ${Φ}/scripts/ci-watch.sh
R := OWNER/REPO (auto-detected from git remote)
AM := auto-merge
Poll a GitHub Actions run, render a live emoji dashboard, dump failed logs on exit, and watch AM if CI is green, AM is enabled on the PR, and the PR has a reviewed label.
Instructions
1. Detect repo
git remote get-url origin
Extract R from the URL (handles both HTTPS https://github.com/OWNER/REPO.git and SSH git@github.com:OWNER/REPO.git).
2. Parse arguments
Map $ARGUMENTS to script flags:
| Input | Flags passed |
|---|---|
bare number (e.g. 42) |
--pr 42 |
--run ID |
--run ID |
--branch NAME |
--branch NAME |
--pr NUMBER |
--pr NUMBER |
--workflow NAME |
--workflow NAME |
--interval N |
--interval N |
| (none) | (omit — script auto-detects branch + ci.yml workflow) |
3. Run the script
bash SCR --repo R [flags]
Use a 600000ms timeout (10 min). Stream output directly — do not buffer.
4. Report result
- Exit 0 → confirm run passed (and, if AM was watched, the PR merged).
- Exit 1 → confirm run failed; note that failed logs were printed above.
- Exit 2 → confirm run was cancelled.
- Exit 4 → CI passed but the PR did not merge (closed / conflicts / auto-merge disabled / watch timed out). ¬a CI failure — do not offer Retry-CI. Route to a merge follow-up: rebase, resolve conflicts, or re-enable auto-merge.
- Non-zero (other) → report the exit code and raw conclusion.
5. Watch auto-merge (if applicable)
AM_eligible(pr) ⟺ PR# known ∧ autoMergeRequest ¬null ∧ label reviewed ∈ PR.
¬AM_eligible → exit after reporting CI passed.
∀ AM_eligible: enter merge-wait loop (live spinner) → exit once merged (0) ∨ green-CI-unmerged (4).
MERGED→ confirm PR merged automatically (exit 0).CLOSED/DIRTY(conflicts) / auto-merge disabled / watch timeout → exit 4 (see §4).BEHIND/BLOCKED/UNSTABLE→ transient, keep polling (¬terminal).
Timeout: the loop self-bounds at MERGE_WAIT_TIMEOUT (script, 15 min) → graceful exit 4. This is only reachable if the Bash timeout you pass exceeds CI-watch time + that bound — when a PR is expected to auto-merge, allow a Bash timeout ≥ 20 min so the script's exit 4 fires instead of a hard SIGKILL.
Chain Position
- Phase: Verify
- Predecessor:
/R-pr(via/R-dev) · orreviewedlabel step (via/R-ship) - Successor:
/R-validate(via/R-dev) · or/R-cleanup(via/R-shipafter merge) - Class: adv (continuous flow, no gate)
Task Integration
/R-devowns the dev-pipeline task lifecycle externally- This skill does NOT update its own dev-pipeline task
- Sub-tasks created: none
- Follow-up: CI failure →
/R-devmay create a re-run / fix follow-up task
Exit
- CI green via
/R-dev: return control silently. ¬write summary. ¬ask user. ¬announce/R-validate./R-devre-scans and advances. - CI green standalone: print one line:
CI passed. Next: /R-validate. Stop. - CI failed/cancelled (exit 1/2): return error.
/R-devpresents Retry | Skip | Abort (or creates a follow-up fix task depending on failure type). - CI green but unmerged (exit 4): ¬a CI failure — report the merge blocker (conflicts / closed / auto-merge off / timeout) and route to rebase / resolve / re-enable, ¬Retry-CI.
$ARGUMENTS