Which caches can a branch restore from?
AdvancedConceptCaching, Artifacts, Runners & ARC
Answer
A run can restore caches created on its own branch (ref), on the base branch for PRs, and on the default branch. It cannot read caches from sibling feature branches or child branches. PR runs create caches scoped to refs/pull/N/merge, visible only to that PR. So warming caches on main (a push or schedule run) benefits every PR, while caches saved inside PRs mostly benefit re-runs of that PR. This isolation also prevents a malicious PR from poisoning caches used by main.
More on Caching, Artifacts, Runners & ARC
How does `actions/cache` match keys and restore keys?IntermediateWhat are the cache size limits and eviction rules?BeginnerWhen should you use setup-* built-in caching instead of `actions/cache`?BeginnerWhy cache the package manager's download cache rather than `node_modules`?AdvancedHow do `actions/cache/restore` and `actions/cache/save` help?AdvancedHow do you cache Docker layers in GitHub Actions?Intermediate