Share the cache remotely
CI and teammates reuse builds instead of repeating them.
Turborepo docsturborepo.dev
Remote caching dramatically speeds up CI by sharing cached artifacts across runs.
From turborepo, caching/remote-cache.md and ci/github-actions.md.
CI after your laptop built it
You built this commit locally. Push it and run CI.
Local cache onlyBad
no TURBO_TOKEN in CIRemote cacheGood
TURBO_TOKEN + TURBO_TEAM# locally, once
npx turbo login
npx turbo link
# .github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
permissions: { contents: read, id-token: write }
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 2 }
- uses: vercel/setup-turborepo-remote-cache-action@v1.1.0 # OIDC: sets TURBO_TOKEN, TURBO_TEAM
with: { team: ${{ vars.TURBO_TEAM }} }
- run: pnpm install --frozen-lockfile
- run: turbo run build test lint --affected
Why it matters, pros and cons
Why it matters
The cache key is a content hash, so an artifact built on any machine is valid on any other. A shared store turns someone's build into everyone's hit.
Pros
- CI skips work a teammate already did.
- Vercel deploys enable it with no setup.
- OIDC avoids long-lived tokens.
Cons
- Missing
enventries now leak across machines. - Sign artifacts if the store isn't fully trusted.
actions/cacheis a branch-scoped fallback.