Skip to content
Latchkey

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_TOKEN and TURBO_TEAM in 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-only

Gotchas

  • 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

Run this faster and cheaper on Latchkey managed runners. Start free →