Skip to content

ericrisco/rsc-harness / skills/github-actions

github-actions

Verified

Use when authoring or fixing GitHub Actions CI/CD — workflows under .github/workflows, triggers, job matrix, caching, token permissions, OIDC cloud deploys, environment gates, reusable workflows. NOT the Dockerfile or image build strategy (that is `docker`), NOT the branching model (that is `git-workflow`), NOT release readiness (that is `ship`).

FileKindSize
SKILL.mdskill md13.1 KB
evals/README.mdmarkdown985 B
evals/cases.yamlconfig3.2 KB
references/caching-and-matrix.mdmarkdown3.9 KB
references/oidc-deploys.mdmarkdown4.6 KB
scripts/verify.shexecutablescript4.1 KB

references/caching-and-matrix.md

View on GitHub
# Caching and matrix recipes

Deep patterns for cache keys, Docker layer caching, matrix shaping, and runner-minute cost. The SKILL.md covers the common case; reach for this when a monorepo, a Docker build, or a large matrix makes the simple version waste minutes.

## Cache keys beyond the simple case

A cache entry is **immutable per key**. Once written, that key returns the same bytes until the key string changes. So the key must encode everything that should invalidate the cache.

```yaml
# Multiple lockfiles (monorepo) — hash all of them so any change rotates the key
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
  ${{ runner.os }}-deps-
```

`restore-keys` is an ordered prefix-fallback list. On an exact-key miss, GitHub restores the newest cache whose key starts with the first prefix that matches, then the next, etc. That turns a "one dependency changed" cold start into a warm partial hit — you re-resolve only the delta.

Per-workspace caches in a monorepo: put the package path in the key so each package gets its own entry instead of one giant shared cache that thrashes:

```yaml
key: ${{ runner.os }}-${{ matrix.pkg }}-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.pkg)) }}
```

## Docker layer cache via buildx + gha backend

For image builds inside a workflow, cache layers with the GitHub Actions cache backend (`type=gha`) so unchanged layers do not rebuild. The *image design* itself is the docker skill's concern — this is only the caching wiring.

```yaml
- uses: docker/setup-buildx-action@<full-40-char-sha>
- uses: docker/build-push-action@<full-40-char-sha>
  with:
    context: .
    push: false
    cache-from: type=gha
    cache-to: type=gha,mode=max
```

`mode=max` caches all layers (including intermediate build stages), not just the final image — bigger cache, far more hits on multi-stage builds.

## Matrix shaping

`include` adds cells or extra variables; `exclude` removes specific combinations. They compose: the matrix is built, `exclude` prunes, then `include` appends.

```yaml
strategy:
  fail-fast: false
  max-parallel: 6
  matrix:
    os: [ubuntu-latest, macos-latest, windows-latest]
    node: [20, 22, 24]
    exclude:
      - { os: windows-latest, node: 20 }   # drop an unsupported combo
      - { os: macos-latest, node: 20 }
    include:
      - { os: ubuntu-latest, node: 24, coverage: true }  # one cell does coverage
```

- `fail-fast: false` — every cell reports, even after one fails. Use it for compatibility matrices where you want the full grid of results.
- `fail-fast: true` (default) — first failure cancels the rest. Use it to save minutes when any failure is a stop-the-line event.
- `max-parallel` — cap concurrent cells when a shared resource (a test DB, a rate-limited API) cannot take the full fan-out.

Dynamic matrix from a previous job (e.g. only the packages that changed): a setup job emits JSON via `$GITHUB_OUTPUT`, and the matrix consumes it with `fromJSON`:

```yaml
jobs:
  discover:
    runs-on: ubuntu-latest
    outputs:
      pkgs: ${{ steps.set.outputs.pkgs }}
    steps:
      - id: set
        run: echo "pkgs=$(./scripts/changed-packages.sh)" >> "$GITHUB_OUTPUT"
  test:
    needs: discover
    strategy:
      matrix:
        pkg: ${{ fromJSON(needs.discover.outputs.pkgs) }}
    runs-on: ubuntu-latest
    steps: [...]
```

## Runner-minute cost

GitHub bills minutes by runner OS with a multiplier on hosted runners:

| Runner | Relative cost |
| --- | --- |
| Linux (`ubuntu-latest`) | 1x — the baseline |
| Windows | ~2x |
| macOS | ~10x |

So: do the bulk of the matrix on Linux, and only add macOS/Windows cells where the platform difference actually matters (native modules, platform-specific builds). `exclude` the cheap-to-skip combinations rather than running the full cartesian product on every OS. A matrix of `3 OS x 4 versions = 12` cells with a 10x macOS multiplier costs far more than `8 ubuntu + 2 macos + 2 windows` shaped with `exclude`.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall