github-actions

A practical guide to GitHub Actions, GitHub's system for automatically running tasks such as tests and deployments when repository events occur.

In plain words
What is it for?
It helps write and debug CI/CD workflows, where CI checks code automatically and CD can deliver it to a target environment.
Why use it?
It explains common workflow rules and debugging details, including triggers, job dependencies, conditions, retries, secrets, timeouts, and delayed schedules.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/st1page/agent-knowledge-framework/github-actions
Any agent
npx skills add st1page/agent-knowledge-framework --skill github-actions
Clone the repo
git clone --depth 1 https://github.com/st1page/agent-knowledge-framework

Made for: Claude Code, Codex.

Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,018 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00069 $0.02018
Opus 5 $0.00034 $0.01009
Sonnet 5 $0.00014 $0.00404
Haiku 4.5 $0.00007 $0.00202

Measured 2d ago against content hash 57bf0124b02b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

github-actions scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -f https://example.com/api
roles/maintainer/skills/github-actions/SKILL.md · 230 lines

How it starts

The opening of the file, as written. The whole thing — 230 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GitHub Actions 实战编写与调试

目标:快速编写正确的 GitHub Actions workflow,高效调试失败,理解平台行为边界。

实验仓库:st1page/gh-actions-lab(9 个场景的完整 workflow 示例)

1. 触发方式速查

触发 on: 写法 典型用途
Push push: { branches: [main], paths: ["src/**"] } CI
PR pull_request: { branches: [main] } 代码审查
定时 schedule: [{ cron: "*/15 * * * *" }] 周期任务
手动 workflow_dispatch: { inputs: ... } 按需触发
API repository_dispatchgh workflow run 外部集成

paths filter 边界:只匹配 push 事件中实际变更的文件;如果 commit 没改 src/** 下的文件,即使 push 到 main 也不触发。workflow_dispatch 触发时 paths filter 不生效。

cron 延迟:GitHub 不保证 cron 准时触发,高峰期可延迟 5–30 分钟。Cron 只在 default branch 生效。

2. Job 依赖与条件执行

needs DAG

jobs:
  build: ...
  test-unit:
    needs: build        # build 完成后才跑
  test-integration:
    needs: build        # 与 test-unit 并行
  deploy:
    needs: [test-unit, test-integration]  # 两个都过才 deploy

needs 形成 DAG,同层无依赖的 job 自动并行。

if 条件

# commit message 包含 [deploy] 时才执行
- if: contains(github.event.head_commit.message, '[deploy]')

# 仅 PR 事件
- if: github.event_name == 'pull_request'

# 前置 job 失败也要跑(清理/汇报)
jobs:
  observer:
    needs: [job_a, job_b]
    if: always()    # 不管前置结果都跑

concurrency 控制

concurrency:
  group: deploy-${{ github.ref }}
  cancel-in-progress: true    # 新 run 自动取消旧 run

3. 重试策略

Step 级重试(nick-fields/retry)

- uses: nick-fields/retry@v3
  with:
    timeout_minutes: 2
    max_attempts: 3
    retry_wait_seconds: 5
    command: |
      # 可能偶发失败的命令
      curl -f https://example.com/api

Run 级重跑

# 全量重跑(所有 job 重新执行)
gh run rerun <run-id>

# 仅重跑失败的 job(已成功的跳过)
gh run rerun <run-id> --failed

run_attempt 递增:每次 rerun,github.run_attempt +1(首次为 1)。可用于区分首次运行和重跑:

- run: echo "Attempt ${{ github.run_attempt }}"

Artifact 名中带 attempt 可追踪每次运行的产物差异。

4. Secret & Variable 注入

设置

gh secret set API_KEY --body "xxx" -R owner/repo
gh variable set DEPLOY_TARGET --body "staging" -R owner/repo

Read the full file on GitHub · 230 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 230 lines · 69 tokens per session scan A 57bf0124b02b

Subscribe to this mod's changes

github-actions is a skill published in the GitHub repository st1page/agent-knowledge-framework (41 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 69 tokens to every session and 2,018 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens