How to Work Within the 10GB Cache Limit and Eviction in GitHub Actions
GitHub keeps up to 10 GB of cache per repository and evicts least-recently-used entries once you exceed it.
When total cache size for a repo crosses 10 GB, GitHub evicts the least recently used entries until it is back under the cap. Unused caches are also removed after 7 days. Keep keys tight so big, stale caches do not push out the ones you rely on.
Steps
- List current caches with the gh CLI to see what is consuming space.
- Delete stale caches you no longer need.
- Narrow paths and keys so each cache stays small.
Inspect and prune
Terminal
# list caches sorted by size
gh cache list --sort size --order desc
# delete a specific cache by id or key
gh cache delete <cache-id>Gotchas
- Caches unused for 7 days are removed regardless of the size cap.
- A single huge build cache can evict many small dependency caches; split them.
Related guides
How to Bust a Cache With a Version Prefix in GitHub ActionsInvalidate a poisoned or stale GitHub Actions cache by bumping a version segment in the key or a CACHE_VERSIO…
How to Save a Cache Only on the Default Branch in GitHub ActionsWrite caches only from default-branch runs in GitHub Actions using the save sub-action with an if on github.r…