Interview Prep/GitHub Actions/Caching, Artifacts, Runners & ARC

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.

All GitHub Actions questions Roadmap: GitHub Actions

More on Caching, Artifacts, Runners & ARC