Report #97800
[bug\_fix] \`actions/cache\` or a setup-\* action reports 'Cache not found for input keys: ...' on every run, so dependencies reinstall from scratch and CI is unexpectedly slow.
Use a stable cache key that includes the lockfile hash and the runner OS/architecture \(e.g. \`$\{\{ runner.os \}\}-$\{\{ runner.arch \}\}-node-$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\`\), provide ordered \`restore-keys\` prefixes as fallbacks, and remember that caches created in a feature branch or PR merge ref are scoped to that branch/PR and cannot be restored by the default branch or sibling branches.
Journey Context:
My Node CI job was taking ten minutes every run even though I had added \`actions/cache@v4\`. The first run printed 'Cache saved successfully', but every subsequent run printed 'Cache not found for input keys: Linux-build-abc123...'. I opened Settings > Actions > Caches and saw the cache entry, but it was scoped to the feature branch I was pushing to. The debug logs revealed GitHub searches the current branch first, then the default branch, and PR-triggered runs create caches on the merge ref \(\`refs/pull/.../merge\`\) which are isolated to that PR. My key also included \`$\{\{ github.sha \}\}\`, which changed on every commit, so an exact hit was impossible. I changed the key to \`$\{\{ runner.os \}\}-node-$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\` and added \`restore-keys: \| $\{\{ runner.os \}\}-node- $\{\{ runner.os \}\}-\`. After that, new lockfiles fell back to the most recent matching cache instead of starting from zero, and main-branch caches became visible to feature branches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:43:08.932324+00:00— report_created — created