A package manager keeps every package it downloads in a store on disk, and a new virtual machine starts with that store empty. Mount a named sticky disk where the store is, and later builds of the repository start with the packages your default branch last downloaded.
This page lists where each store is on our runners, and what to add to a workflow for each. Sticky disks have to be turned on for your organisation first.
| package manager | mount the disk at | make this folder first | tell the tool |
|---|---|---|---|
| npm | ~/.npm | ||
| pnpm | ~/.pnpm-store | pnpm install --store-dir ~/.pnpm-store | |
| Yarn 1 | ~/.cache/yarn | ~/.cache | |
| Yarn 4 | ~/.yarn/berry | ~/.yarn | |
| Bun | ~/.bun/install/cache | ~/.bun/install | |
| pip | ~/.cache/pip | ~/.cache | |
| uv | ~/.cache/uv | ~/.cache | |
| Poetry | ~/.cache/pypoetry | ~/.cache | |
| Go modules | ~/go/pkg/mod | ~/go/pkg | |
| Go build cache | ~/.cache/go-build | ~/.cache | |
| Cargo registry | /usr/local/cargo/registry | ||
| Cargo git sources | /usr/local/cargo/git | ||
| Gradle | ~/.gradle/caches | ~/.gradle | |
| Maven | ~/.m2/repository | ~/.m2 | |
| NuGet | ~/.nuget/packages | ~/.nuget |
An empty "tell the tool" cell means the path is already where the tool looks.
For pip, as an example:
jobs:
test:
runs-on: runnersio-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- run: mkdir -p ~/.cache
- uses: runners-io/stickydisk@v1
with:
key: ${{ github.repository }}-pip
path: ~/.cache/pip
- run: pip install -r requirements.txtPut the disk step before the step that installs, and give each package manager a key of its own. A job can have up to five named disks.
Make the folder above the mount point first. If the folder in the third column does not exist, runners-io/stickydisk v1.1.1 and earlier make it as root, and every other tool that keeps something in that folder can no longer write there. A mkdir -p step before the action makes it as the runner, whichever version of the action runs. When the cell is empty, nothing is needed.
pnpm keeps its store wherever PNPM_HOME points when that is set, and pnpm/action-setup sets it, so tell pnpm install where the store is:
- uses: runners-io/stickydisk@v1
with:
key: ${{ github.repository }}-pnpm
path: ~/.pnpm-store
- run: pnpm install --store-dir ~/.pnpm-storeThe store is on a different disk from your checkout, so pnpm copies packages out of it instead of linking them.
Yarn 2 and 3 keep the cache inside the repository, in .yarn/cache, unless enableGlobalCache is on. Yarn 4 turns it on by default, and the row above is for that.
Cargo keeps its registry and git sources in CARGO_HOME, which is /usr/local/cargo on our runners, not ~/.cargo. Never mount a disk at the whole of CARGO_HOME: it holds the Rust toolchain's binaries and can hold credentials.toml.
A store holds packages and nothing else, and that is why each row is the store alone and never the tool's whole folder. Keep ~/.npmrc, ~/.m2/settings.xml, ~/.gradle/gradle.properties, ~/.yarnrc.yml, ~/.config/pip and any other file that can hold a token off the disk. Sticky disks has the reason.
Everything on Sticky disks applies:
The first run that names a key runs without the disk, the second gets an empty one, and the third starts with what the second kept.
Only a successful build of your default branch, from a trusted trigger, keeps what it downloaded. A pull request's build starts from that and keeps nothing.
A key not used for 7 days is deleted.
Every disk counts toward your sticky-disk storage, billed on what it holds.
On a runner that is not ours the action does nothing, so the same workflow still runs on GitHub's runners.
Sticky disks: the default disk, scope, and which builds keep their changes.
The Actions cache: a keyed archive instead of a disk, included.