跳到正文
cccskills
免费在 GitHub 公开

github-actions-prevent-waste

Reduce wasted GitHub Actions PR checks with stable concurrency keys, cancellation of superseded runs, and job-level draft guards.

中文简介正在准备中。当前显示原文说明。

集成工具GitHub
查看安装方法

包含的文件(1)

  • SKILL.md1.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Prevent wasted GitHub Actions runs

For PR checks, cancel superseded runs and skip jobs while the PR is a draft:

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true
  • Keep keys stable across commits: use a unique workflow prefix and PR number or ref, never a commit SHA or run ID. Reusable workflows inherit the caller's github.workflow; keep caller and callee concurrency keys distinct.
  • Add github.event.pull_request.draft != true to each check job's existing if, including reusable-workflow callers and aggregate jobs. Job guards prevent runner allocation; step guards still allocate runners.
  • Preserve existing triggers when adding ready_for_review and converted_to_draft. The former starts checks when review begins; the latter lets a replacement run cancel old work before its jobs skip.
  • Concurrency cancellation needs a new run in the same group. If path filters prevent that run, use a trusted cleanup workflow on PR updates to cancel only older heads, rechecking the current head before cancellation. Never check out PR code in privileged cleanup.

References: concurrency, PR events.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Reference for concurrent steps within a GitHub Actions job and the background, wait, wait-all, cancel, and parallel keywords.

中文简介正在准备中。当前显示原文说明。

stablyai/skills52026年10月17日 更新

查看 stablyai 的全部技能

报告此技能的问题