agentleFS
danmestasdanmestas/wardrobe/skills/ci-watch/SKILL.md

ci-watch

Skill4 starsChanged 7 months agoMITView on GitHub

Use when watching CI/CD checks complete — `gh pr checks`, `gh run watch`, polling PR conclusion, waiting for builds to finish before merge. Triggers: 'watch CI', 'wait for build', 'poll PR', 'check CI status', 'is the build done', '/ci-watch'.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this for polling. It's cheap (one HTTP call), it's stable (no streaming connection to keep alive), and the exit code is the answer.

    line 35
  2. Very specific:

    Prefer the non-watch form inside a poll loop — --watch ties up the shell and doesn't compose with ScheduleWakeup.

    line 42
  3. Very specific:

    When you have a specific run ID (from gh run list or returned by a workflow trigger), gh run watch blocks until the run finishes and …

    line 46
  4. Very specific:

    When you don't have a run ID (PR-level checks, multi-workflow), poll gh pr checks on a cadence.

    line 56
  5. Distinctive:

    Never poll at 300s — pay the cache miss without amortizing

    line 60
  6. Distinctive:

    Don't report "CI is still running" repeatedly.

    line 106

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

ci-watch: Watching CI to Completion

CI is the canonical "external event you're waiting on" — pair this skill with the wait-watch mode for cadence rules. This skill covers the mechanics: which gh command for which situation, how to read exit codes, how to tell a real failure from a flake.

Surface

gh pr checks <PR> — rolling status

Returns the current state of every check on a PR. Exit codes carry the verdict:

  • 0 — all checks passed
  • 1 — at least one check failed
  • 8 — checks still pending

Use this for polling. It's cheap (one HTTP call), it's stable (no streaming connection to keep alive), and the exit code is the answer.

gh pr checks 168            # human-readable
gh pr checks 168 --watch    # blocks, prints updates as checks resolve

Prefer the non-watch form inside a poll loop — --watch ties up the shell and doesn't compose with ScheduleWakeup.

gh run watch <run-id> --exit-status — block to completion

When you have a specific run ID (from gh run list or returned by a workflow trigger), gh run watch blocks until the run finishes and returns 0 on success / non-zero on failure. Right for "I just kicked off this run, wake me when it's done":

gh run watch 12345678 --exit-status

Pair with Bash run_in_background: true so the wait doesn't burn the foreground turn.

Polling without gh run watch

When you don't have a run ID (PR-level checks, multi-workflow), poll gh pr checks on a cadence. Defer to the wait-watch mode's cadence rules:

  • Build expected within ~5 min → poll every 60–270s
  • Idle / unknown completion time → poll every 1200–1800s
  • Never poll at 300s — pay the cache miss without amortizing
until gh pr checks 168 --required; do sleep 270; done

(Run this via Monitor so each check turns into a notification, not a foreground block.)

Distinguishing flakes from real failures

Red checks aren't all the same. Before declaring a PR broken, look for the failure shape:

gh run view <run-id> --log-failed | tail -200

Flakes look like:

  • npm ERR! network / ETIMEDOUT against the registry
  • Runner provisioning errors (Error: The runner has received a shutdown signal)
  • connection refused against an external service
  • Action-version-not-found (registry hiccup)

Real failures look like:

  • Test assertions
  • Type errors / lint errors
  • Build / compile failures
  • Missing files

For a flake, gh run rerun <run-id> and re-poll. Wait at least 30 seconds after a rerun before polling — the new run needs time to register, and a too-fast poll will read the old (failed) status and falsely report still-broken.

Gating actions on green CI

Surface these separately from the watch loop — they're "what to do once it's green", not "how to wait":

  • gh pr ready <PR> — flip draft to ready for review
  • gh pr merge <PR> --merge --delete-branch — merge and clean up the branch in one shot. Add --auto to queue the merge for whenever CI goes green.

The --delete-branch flag deletes the remote branch on merge; combine with git branch -d <name> locally and git fetch --prune to clear the stale ref.

Reporting

When CI completes:

  • Pass: one line — "PR #168 green (7/7 checks)" — and proceed to the gating action.
  • Fail (real): summarize which check failed and the failure mode. Don't dump the whole log.
  • Fail (flake suspected): name the flake pattern, rerun, set the next check-back per cadence rules.

Don't report "CI is still running" repeatedly. The user knows; the polling cadence is the report.

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.