gh-actions-workflow

Write or fix a GitHub Actions CI workflow - test matrix, dependency caching, least-privilege permissions, concurrency and pinned actions. Use when the user wants CI for a repo, a workflow is failing or slow, or asks to harden GitHub Actions.

Qu'est-ce que gh-actions-workflow ?

gh-actions-workflow is a Claude Code agent skill that write or fix a GitHub Actions CI workflow - test matrix, dependency caching, least-privilege permissions, concurrency and pinned actions. Use when the user wants CI for a repo, a workflow is failing or slow, or asks to harden GitHub Actions.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Ralpberry-Labs/agent-skills-library/tree/HEAD/skills/gh-actions-workflow

Installed? Explore more Développement et programmation skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

GitHub Actions workflow

Before writing

Detect the stack and the real commands from the repo (manifest scripts, Makefile, tox/nox, existing CI). Use the same commands developers run locally.

Template (adapt, do not paste blindly)

name: CI
on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read            # least privilege by default; widen per job only if needed

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true  # stop superseded runs on the same branch/PR

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    strategy:
      fail-fast: false
      matrix:
        node: [22, 24]
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test

Check the latest major versions of actions/checkout, actions/setup-node, actions/setup-python etc. on their GitHub release pages before writing; do not guess.

Rules

  • Permissions: set permissions at the top level to the minimum. Jobs that comment on PRs need pull-requests: write; publishing needs contents: write or id-token: write for OIDC.
  • Pin third-party actions to a full commit SHA (with the version in a comment). First-party actions/* on a major tag is a common, acceptable trade-off.
  • Never echo secrets, and never pass secrets to workflows triggered by pull_request_target that check out untrusted PR code.
  • Untrusted input: do not interpolate ${{ github.event.issue.title }} or other user-controlled fields directly into run: scripts; pass them through env: and quote them, to avoid script injection.
  • Caching: use the setup action's built-in cache: option before reaching for actions/cache.
  • Speed: split lint/typecheck/test into parallel jobs only when each takes more than a minute; otherwise the setup overhead dominates.
  • Timeouts: always set timeout-minutes so hung jobs do not burn minutes.

When fixing a failing workflow

  1. Get the logs: gh run list --limit 5, then gh run view <id> --log-failed.
  2. Reproduce the failing command locally if possible.
  3. Fix the cause, not the symptom (do not add continue-on-error to make it green).
  4. Validate syntax with actionlint if available.

Skills associés