Feature branch builds restore caches created on the default branch but have limited ability to pollute default-branch caches. Why do teams still prefer saving warm caches from main/default CI?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Cache access is branch-scoped: default branch caches seed PR restores. Keeping main CI green and caching there warms the whole team.
Full explanation below image
Full Explanation
GitHub Actions cache scoping allows pulls from the default branch and ancestors in ways that help PR performance, while restrictions reduce untrusted branches overwriting shared caches. Teams ensure main runs install/build caching regularly so restore-keys find recent entries. Feature branches can still use actions/cache for their own keys. Caches are not secrets. Understanding scope avoids 'works on main only' cold PR CI. Combine with lockfile-based keys for correctness.