Docs
Dependency caching
Each job gets back the package stores and build caches the last job on your default branch left. There is no step to add.
What’s kept
These folders are restored at the start of a job and saved after it:
| Folder | Path |
|---|---|
| pnpm-store | ~/.local/share/pnpm/store |
| npm | ~/.npm |
| yarn | ~/.cache/yarn |
| go-build | ~/.cache/go-build |
| go-mod | ~/go/pkg/mod |
| pip | ~/.cache/pip |
| cargo-registry | ~/.cargo/registry |
| playwright | ~/.cache/ms-playwright |
They count toward the repository’s 10 GB. A job saves only the folders it changed. Tool versions in /opt/hostedtoolcache aren’t kept, since the image has them. Task outputs from turbo and nx aren’t kept either.
See how to cache pnpm in GitHub Actions.
When a job saves
Every job restores them. A job saves only when all of these are true:
- The job succeeded.
- The run came from a
push,scheduleorworkflow_dispatch. - It ran on the repository’s default branch.
- The code is from the repository itself, not a fork.
Pull requests start from what the default branch saved, but never fill it. See Cache security.
Switch one off
On the Caching page, each folder shows as an entry marked Automatic, with its path and size. An admin opens it and chooses Stop saving this folder. That repository’s jobs then neither restore nor save it, and its saved copy is deleted.