cache turborepo setup issues a short-lived cache token and prints the TURBO_* environment variables that turbo needs to talk to the Namespace cache.
The command does not modify your repository or shell: it writes KEY=value lines to stdout, so you can export them locally or append them to a CI environment file.
Learn more about Turborepo caching →
Usage
Example output
Output
Example in a local shell
Export the generated configuration into your shell, then runturbo as usual:
Example in GitHub Actions
Append the generated configuration to$GITHUB_ENV so that subsequent steps pick it up:
Example in Buildkite
Register the token with the Buildkite redactor and export the configuration for the rest of the step:Options
—team <team>
The Turborepo team to use. Teams isolate caches from each other, so different projects can share a workspace without sharing cache entries. This flag is required. Usensc cache turborepo list to see the teams that already have cached artifacts.
—read-only
Only read from the remote cache. SetsTURBO_CACHE=local:rw,remote:r in the generated configuration, so turbo still writes to the local cache but never uploads to the remote one.
Use this for workloads that should benefit from the cache without being able to poison it, such as builds of untrusted pull requests. To enforce read-only access on the server side as well, run the command with a token that only carries the read action:
cache/turborepo actions.
—mask-buildkite
Mask the generated token in Buildkite, so it is redacted from job logs. Requiresbuildkite-agent on PATH; the command fails if it is not found.
—mask-github-actions
Mask the generated token in GitHub Actions, so it is redacted from workflow logs.—mask-auto
Mask the generated token in a detected CI environment. Supported environments are GitHub Actions and Buildkite. Use this when the same script runs in more than one CI system.—output, -o <format>
Output format. One ofplain or json. Default is plain.
json emits the same values as an object, which is convenient when a wrapper script needs to parse them:
—token_duration <duration>
The minimum duration of the configured token. Default is4h. Raise it for jobs that run longer than the default token lifetime.
—token <path>
Use the bearer token stored at this location for authentication instead of the default.Related Topics
- nsc cache turborepo list - List teams with cached artifacts
- nsc token create - Create scoped, revokable tokens
- Turborepo caching - Turborepo caching overview and CI setup
- Permissions -
cache/turboreporesource types and actions