GitHub Action to setup Turborepo CLI Remote Caching in GitHub Workflows.
This documentation is also available at Use Remote Caching from external CI/CD.
In order to use this action, you need to
- create a Turborepo CLI OIDC policy on your team for the GitHub Workflow(s) you want to enable caching on
- add a
TURBO_TEAMrepository variable to your GitHub repository - add this action to your GitHub Workflow(s), before calling Turborepo CLI
On vercel.com, go to your team's Settings → Build and Deployment → OIDC Policies for CLI Access, and click "Add" next to "Turborepo CLI Policies". You can also open the add-policy form directly.
Fill out the form, providing a policy name, choosing a GitHub account and repository. You can optionally restrict to a workflow or branch, and customize the audience.
Create a repository variable called TURBO_TEAM set to your team slug or ID,
which can be found on your team's General settings page on vercel.com. With the
GitHub CLI:
gh variable set TURBO_TEAM --body "your-team-slug"Or add it through the GitHub UI under Settings → Secrets and variables → Actions, on the Variables tab.
Using a repository variable rather than a secret keeps GitHub Actions from censoring your team name in log output.
First, make sure your workflow has the id-token: write permission:
permissions:
contents: read
id-token: writeThen, call the action before invoking Turborepo CLI:
- uses: vercel/setup-turborepo-remote-cache-action@v1.1.0
with:
team: ${{ vars.TURBO_TEAM }}
- run: turbo buildYou can tell it's working if the action succeeds and Turborepo CLI logs
• Remote caching enabled
If more than one of your team's OIDC policies could match this workflow, you will receive an error. Pass the policy ID with the
policyinput to disambiguate.
Required. The Vercel team ID or slug you want to use Remote Caching with.
Optional. A custom audience to include in your GitHub OIDC token's aud
claim. This must match your Vercel team's Turborepo CLI OIDC policy.
Optional. The ID of the Turborepo CLI OIDC policy to use. Set this when more than one of your team's policies could match the GitHub OIDC token, so that the token exchange can pick the intended policy unambiguously.
Optional. Defaults to true. Whether to revoke the Turborepo access token
when the job finishes, so that it stops working even before it would expire on
its own. Revocation runs at the end of the job whether it succeeded or failed.
Set it to false if you need the token to stay valid past the end of the job:
- uses: vercel/setup-turborepo-remote-cache-action@v1.1.0
with:
team: ${{ vars.TURBO_TEAM }}
revoke: falseIf revocation fails, the action logs a warning rather than failing your job. The token remains short-lived either way.
- You create a Turborepo CLI OIDC policy on your team, which recognizes GitHub OIDC tokens belonging to your GitHub Workflow(s)
- Then, this action generates a GitHub OIDC token, exchanges it for a short-lived Turborepo CLI access token
- Then, this action sets the
TURBO_TEAMandTURBO_TOKENenvironment variables, so that subsequent calls to Turborepo CLI have Remote Caching enabled - Finally, when the job finishes, this action revokes the access token, unless
you set the
revokeinput tofalse
The action runs on node24 (a JavaScript action, so that it can revoke the
token in a post step). It has no dependencies and no build step: dist/
contains hand-written ES modules that GitHub Actions runs directly.
dist/main.mjs— token exchange, runs before your other stepsdist/post.mjs— revocation, runs at the end of the jobdist/lib.mjs— shared helpers