- How you use it
- You ask for it
- What it can do
- writes files
- What's inside
The option
| Option | 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_modulesor replace installation. Ensure each matrix runner checks out and installs its dependencies. setup-node. - Workflow artifact: choose for the exact
distproduced 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 flag | Value / default | Applies to | Source |
|---|---|---|---|
actions/cache.path | ~/.npm for the documented npm download cache; not installed modules | cache 6.1.0; npm on Linux/macOS | npm cache example |
actions/cache.key | OS plus lockfile content hash, using runner.os and hashFiles('**/package-lock.json'); max 512 characters | cache 6.1.0 | cache contract |
actions/cache.restore-keys | Ordered prefix fallbacks, e.g. ${{ runner.os }}-build-; fallback contents may be stale | cache 6.1.0; install against the current lockfile afterward | matching |
cache / cache-dependency-path | setup-node cache: npm; point dependency path to the actual lockfile if outside root | setup-node 7.0.0 | inputs |
strategy.max-parallel | Start with documented 2, then choose a cap within spare runner/service capacity | GitHub.com matrix job, not an account-wide limit | matrix |
strategy.fail-fast | true cancels sibling matrix jobs on required failure; false when collecting every failure is useful | GitHub.com matrix | matrix failure behavior |
needs | build only when that job consumes build output; omit dependencies between independent lint/test jobs | GitHub.com jobs | prerequisites |
concurrency.group / cancel-in-progress | Group ${{ github.workflow }}-${{ github.ref }}; cancel superseded validation runs where cancellation is intended | GitHub.com workflows | concurrency |
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) | Cause | Fix | Source |
|---|---|---|---|
EUSAGE | npm ci lock validation fails; a cache hit does not establish a valid dependency graph | Compare manifest, lock and npm/config versions; regenerate a genuinely inconsistent lock deliberately, then retain npm ci | npm contract, pavel-golance, 29 October 2026, #10193 |
both workflows will still run in parallel | Matrix max-parallel only bounds one matrix; separate runs collide on a session | Isolate sessions or use a shared concurrency group for the dependent operation | Bilge, 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
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.