Skip to main content

github-actions-prevent-waste

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

来源信息

仓库
stablyai/skills
最近来源活动
2026年10月16日 21:26
检测到的 SKILL.md 语言
英语
星标
5
Forks
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
github-actions-prevent-waste
description
Reduce wasted GitHub Actions PR checks with stable concurrency keys, cancellation of superseded runs, and job-level draft guards.
# Prevent wasted GitHub Actions runs For PR checks, cancel superseded runs and skip jobs while the PR is a draft: ```yaml 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](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency), [PR events](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request).
在 GitHub 查看