nubjs/nub✦ 精选0°

ci-watch

仓库创建 2026年6月4日最近提交 2 小时前SkillHot 收录 1 小时前
▸ 精选理由

避免因提前退出导致的假绿/假红,适合自动化发布流程。

▸ 风险提示

需安装并使用 gh CLI,且需要相应的仓库访问权限。

这个 Skill 做什么

可靠等待并判定 GitHub Actions 运行真正终止并返回可信退出码。

用 gh CLI 和专门的 watcher 脚本可靠地等到 GitHub Actions 真正结束并返回可信的退出码,而不是被早退的 watcher 骗过。当你在 push、打 tag 或打开 PR 后需要根据 CI 结果自动合并、发版或失败回滚时用它,能避免因为队列状态或 API 瞬断导致的误判。特点是会等待目标存在、轮询终态并在首个失败时快速返回,结果可以信赖。

▸ 展开 SKILL.md 英文原文

Watch GitHub Actions CI correctly with the gh CLI — block until a run / PR check rollup is TRULY terminal, then trust the exit code. Invoke (via the Skill tool) whenever you need to wait on CI after a push, tag, or PR-open and act on the result (merge-on-green, release-on-green, fail-fast on red). Encodes the premature-exit pitfall (raw `gh run watch` / `gh pr checks --watch` exit 0 while the run is still QUEUED with no jobs registered, and exit non-zero on a transient API blip) and the blessed fix: `scripts/ci-watch.ts`, which waits for the target to EXIST, polls authoritative terminal status, fails fast on the first failing check, and exits with a status the orchestrator can trust. Run it as a detached run_in_background task.

开发编程CI监控GitHub Actions自动化通用
3.9k
Stars
54
Forks
38
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/nubjs/nub/main/.claude/skills/ci-watch/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/nubjs/nub/main/.claude/skills/ci-watch/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Watching CI with the GitHub CLI

## The pitfall: raw watchers exit early

`gh run watch <id> --exit-status` and `gh pr checks <pr> --watch` are not safe to arm right after a push / tag / PR-open:

- **Premature exit while QUEUED.** With no jobs registered yet, gh sees "nothing in progress" and returns **exit 0** even though the run is still queued.
- **Transient errors read as failure.** A mid-watch `HTTP 401: Bad credentials` (token refresh) or a 5xx exits non-zero, indistinguishable from a real CI failure.
- **No native fix** — `--interval` only tunes the poll cadence.

**Never trust a raw watcher's exit code alone.** Re-verify terminal status with `gh run view <id> --json status,conclus
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有