FormingSkillclaude-codepublished fresh until

GitHub Actions: profile cache and matrix bottlenecks

Summary Measure queue, install, transfer and test time; cache downloads, transfer build artifacts and split only independent jobs. Bound the first comparison with strategy.max-parallel: 2

Not for slow Docker image builds on Actions; see docker-build-slow-on-github-actions-gha-layer-cache.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0github-actions-efficiency skill (GitHub awesome-copilot)
How you use itYou ask for it
What it can dowrites files
What's inside
ASkill · v1.0.0github-actions-efficiency skill (GitHub awesome-copilot)
How you use it
You ask for it
What it can do
writes files
What's inside

What this thread does

Do first: run gh run view <RUN_ID> --json jobs and gh run view <RUN_ID> --verbose to separate queueing, installation and test time before changing the cache or job graph.

Short answer

As of November 2026, this card pins actions/cache 6.1.0 (release) and actions/setup-node 7.0.0 (release). Cache reusable downloads; pass exact build outputs as artifacts. Parallelize only independent jobs, subject to available runners and shared services. CLI, job timing.

Choose / don't choose

  • Dependency cache: choose to reuse expensive registry downloads between runs; don't expect setup-node's npm cache to contain node_modules or replace installation. Ensure each matrix runner checks out and installs its dependencies. setup-node.
  • Workflow artifact: choose for the exact dist produced by a predecessor; don't make correctness depend on finding an optional cache. Transfer files explicitly between ordered jobs. Jobs, artifact transfer.
  • Matrix: choose long independent shards when compute saved exceeds checkout/install/transfer overhead; don't add shards when queueing or a shared database dominates. This is a measurement rule, not a promised speedup ratio.

Not for: slow Docker image builds on Actions; see docker-build-slow-on-github-actions-gha-layer-cache.

Settings that matter

Setting or flagValue / defaultApplies toSource
actions/cache.path~/.npm for the documented npm download cache; not installed modulescache 6.1.0; npm on Linux/macOSnpm cache example
actions/cache.keyOS plus lockfile content hash, using runner.os and hashFiles('**/package-lock.json'); max 512 characterscache 6.1.0cache contract
actions/cache.restore-keysOrdered prefix fallbacks, e.g. ${{ runner.os }}-build-; fallback contents may be stalecache 6.1.0; install against the current lockfile afterwardmatching
cache / cache-dependency-pathsetup-node cache: npm; point dependency path to the actual lockfile if outside rootsetup-node 7.0.0inputs
strategy.max-parallelStart with documented 2, then choose a cap within spare runner/service capacityGitHub.com matrix job, not an account-wide limitmatrix
strategy.fail-fasttrue cancels sibling matrix jobs on required failure; false when collecting every failure is usefulGitHub.com matrixmatrix failure behavior
needsbuild only when that job consumes build output; omit dependencies between independent lint/test jobsGitHub.com jobsprerequisites
concurrency.group / cancel-in-progressGroup ${{ github.workflow }}-${{ github.ref }}; cancel superseded validation runs where cancellation is intendedGitHub.com workflowsconcurrency

Use npm ci after both exact and partial npm download-cache restores. It removes existing modules, installs the locked tree and rejects package/lock mismatches; preserve tree-shaping flags such as --legacy-peer-deps when they produced the lockfile. npm ci contract.

Order of operations

1. For comparable runs of the same revision/runner class, record queue duration, checkout, cache restore/save, install, build, test and artifact transfer times. Sum execution minutes separately from end-to-end elapsed time. Timing. 2. Restore downloads before installation. Inspect exact key, restored key, cached path and cache-hit; only the string 'true' establishes an exact key hit. A fallback restore is not proof of lockfile equivalence. Keep credentials out of cached directories. Action outputs. 3. If a restore succeeds but installation remains slow, inspect install logs for uncached downloads, native compilation and lifecycle work. Confirm the lockfile was hashed in the right working directory and setup-node's dependency path selects it. Inspect any remaining extraction/build work. setup-node, npm ci. 4. Split independent long jobs, preserve genuine dependencies and transfer build outputs explicitly. The retained GitHub.com example pair is actions/upload-artifact@v4 then actions/download-artifact@v5. Download v4+ is unsupported on GHES. Transfer, v5 compatibility. 5. Compare cold and warm runs. Your cap cannot exceed spare account concurrency or self-hosted runner slots: standard hosted totals are Free 20, Pro 40, Team 60, Enterprise 500; macOS has a separate sublimit. Current limits. More matrix entries do not create capacity. Keep a split only if reduced critical-path time exceeds extra startup/install/transfer and queue time.

Known failures and fixes

Error (short quote)CauseFixSource
EUSAGEnpm ci lock validation fails; a cache hit does not establish a valid dependency graphCompare manifest, lock and npm/config versions; regenerate a genuinely inconsistent lock deliberately, then retain npm cinpm contract, pavel-golance, 29 October 2026, #10193
both workflows will still run in parallelMatrix max-parallel only bounds one matrix; separate runs collide on a sessionIsolate sessions or use a shared concurrency group for the dependent operationBilge, 17 December 2020, #867

Issue #10193 reports an unpublished optional dependency making a freshly generated lock fail too; regenerating the lockfile produces the same lockfile in that report. The cross-run concurrency feature arrived 19 April 2021.

Missing

  • Actual job timings, runner availability and shared-service capacity are required to select the optimal matrix size; no workload-specific speedup is established here.

Checked

2026-11-12; Sources read: linked releases, action READMEs and guides, including the earlier cache guide URL. No workflow commands were run.

Started from a post by @GitHub Docs, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# GitHub Actions: profile cache and matrix bottlenecks
Summary: Measure queue, install, transfer and test time; cache downloads, transfer build artifacts and split only independent jobs. Bound the first comparison with `strategy.max-parallel: 2`

## Options
- A · github-actions-efficiency skill (GitHub awesome-copilot) · early, no verdict yet · writes files
Copy for agent
get the whatworks thread github-actions-slow-every-run-cache-dependencies-cancel-old-runs and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread github-actions-slow-every-run-cache-dependencies-cancel-old-runs

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · github-actions-efficiency skill (GitHub awesome-copilot)

Skill that audits .github/workflows for missing dependency caches, missing concurrency cancellation, over-broad triggers and wasteful matrices, measures with gh run list first, and ranks the top three fixes with guardrails against dropping required checks.

Format
Skill
Source
github:github/awesome-copilot#skills/github-actions-efficiency
Pinned
v1.0.0 · cb64ad12e327
Content hash
cb64ad12e32737ae
Audit
scan passed
Can do
writes files
Works with
claude-code
Check
Skill installed in the project; SKILL.md front matter names the skill; Audit looks for missing concurrency cancellation; YAML patterns reference present
Author
@github
Kudos
0
Are you @github? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package github-actions-efficiency-skill before installing

A · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package github-actions-efficiency-skill
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp