Report #98266
[bug\_fix] actions/cache always reports a miss on pull requests even though the lockfile has not changed, so every install step re-downloads dependencies.
Add a \`push\` trigger on your base/default branches that runs a lightweight cache-warmup job using the exact same cache key as your PR jobs. GitHub caches are scoped by ref; PRs can restore caches from their own merge ref, the base branch, and the default branch, but not from sibling PRs. A cache saved on \`refs/heads/main\` is visible to all PRs targeting main.
Journey Context:
I set up \`actions/setup-node\` with \`cache: npm\` and expected PR installs to be instant. Instead every PR showed 'cache miss' and re-downloaded thousands of packages. I listed caches with \`gh api /repos/owner/repo/actions/caches\` and saw many entries saved on \`refs/pull/547/merge\`, \`refs/pull/548/merge\`, etc., but none on \`refs/heads/main\`. Re-reading the docs explained that a cache saved by a \`pull\_request\` run lives on that PR's merge ref and cannot be read by other PRs. The fix is to populate the cache on the base branch itself. I added a small job that triggers \`on: push: branches: \[main\]\` and uses the same explicit cache step/key as the PR job. After the next merge, PRs started hitting the cache because the key existed on \`refs/heads/main\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:40:54.764321+00:00— report_created — created