How to Use Turborepo Remote Cache in GitHub Actions
Setting TURBO_TOKEN and TURBO_TEAM lets turbo pull cached task outputs from the remote cache instead of rebuilding.
Export TURBO_TOKEN (a secret) and TURBO_TEAM as env vars. turbo automatically reads them and hits the remote cache for every task with a matching hash.
Steps
- Store the remote cache token as a repository secret.
- Set
TURBO_TOKENandTURBO_TEAMin the workflow env. - Run
turbo run build; cache hits skip rebuilds.
Workflow
.github/workflows/ci.yml
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npx turbo run build --remote-onlyGotchas
- Without a signed token, turbo silently falls back to local cache only.
- A 403 from the remote cache usually means the token and team do not match.
Related guides
How to Build Only Affected Packages With Turborepo in GitHub ActionsBuild only changed Turborepo packages in GitHub Actions with turbo run build --filter and a since ref, scopin…
How to Use Nx Cloud Distributed Task Execution in GitHub ActionsDistribute Nx tasks across agents in GitHub Actions with Nx Cloud, starting agents with nx-cloud start-ci-run…