Getting started with GitHub Actions
To use turborepo caching, you can simply add Namespace’ssetup-turbocache to your workspace:
Configuration
By default, caching is performed to a single shared storagemain. But you can isolate your caches by specifying a separate team (in turbo parlance):
Using from your local workstation
You can also use Namespace’s turborepo cache from your local machine. Since the cache is shared, local builds benefit from artifacts already cached by CI — and vice versa. First, install the Namespace CLI. Then use the CLI to configure your shell:nsc cache turborepo setup issues a short-lived cache token and prints the environment variables that turbo needs:
Output
--team can be any string, and can be used to split caches between different projects. Run nsc cache turborepo list to see the teams that already hold cached artifacts.
Alternatively, you can run:
turbo.json.
Read-only access
Pass--read-only to consume the cache without publishing to it. This sets TURBO_CACHE=local:rw,remote:r, so turbo still writes to your local cache but never uploads:
--read-only configures the turbo client. To also enforce read-only access on the server side — for example for builds of untrusted pull requests — run the setup command with a token that only carries the read action:
nsc cache turborepo setup --token <path>, or set NSC_TOKEN_FILE when the token was written with --token_file.
See Permissions for the full list of cache/turborepo actions, and nsc token create for expiration and scoping options.
Getting started with Buildkite
In Buildkite, run the setup command at the start of the step and export the configuration into the step’s shell:--mask-buildkite registers the issued token with the Buildkite redactor, so it is redacted from job logs. It requires buildkite-agent on PATH, which is the case on Namespace-managed Buildkite agents.
Usage
Namespace accounts Turborepo cache usage in two categories:- Turborepo cache storage
- Turborepo cache reads