Skip to content

Repository files navigation

buildrush/cache

build-dist

Drop-in replacement for actions/cache@v5 backed by Build_Rush.

Same inputs. Same outputs. Faster cache.

Quickstart

Replace this:

- uses: actions/cache@v5with:
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}path: node_modules

With this:

jobs:
build:
permissions:
id-token: write # required — Build_Rush mints an OIDC token to authenticatecontents: readsteps:
- uses: buildrush/cache@v1with:
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}path: node_modules

Sign up at buildrush.io and enable cache for your installation.

Split usage

If you already use actions/cache/restore and actions/cache/save separately (for explicit save-on-success or save-from-failure workflows), the Build_Rush analogues are drop-in too:

- id: cache-restoreuses: buildrush/cache/restore@v1with:
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}path: node_modules# ...build steps...
- uses: buildrush/cache/save@v1if: always() && steps.cache-restore.outputs.cache-hit != 'true'with:
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}path: node_modules

Both split actions need permissions: id-token: write on the job (same as the combined action).

Compatibility

Drop-in surface-compatible with actions/cache@v5: identical input names (key, path, restore-keys, enableCrossOsArchive, fail-on-cache-miss, lookup-only, upload-chunk-size) and outputs (cache-hit, plus cache-primary-key and cache-matched-key on the split restore action).

The upstream-deprecated save-always input is intentionally omitted — prefer the split restore/save flow shown above. Build_Rush adds the BR-specific audience, fallback, verbose, and buildrush-reason extensions described below.

Inputs

InputRequiredDefaultNotes
keyyesPrimary cache key.
pathyesFiles, directories, and wildcard patterns to cache and restore.
restore-keysnoOrdered prefix-matched keys for stale-cache fallback. cache-hit stays false on a partial match.
enableCrossOsArchivenofalseAllow Windows runners to save/restore caches that other platforms can read.
fail-on-cache-missnofalseFail the step if the primary key isn't found.
lookup-onlynofalseCheck whether an entry exists without downloading it.
upload-chunk-sizeno33554432 (32 MiB)Bytes per chunk. Applies when the cache service returns a resumable session URI (typically for archives >128 MiB).
fallbacknogithubBuild_Rush-specific. See "Fallback behavior" below.
audiencenohttps://cache.buildrush.ioBuild_Rush-specific. OIDC audience to mint. Override only for non-production cache services.
verbosenofalseBuild_Rush-specific. Print debug-level diagnostics (HTTP statuses, retries, telemetry outcome) to the step log.
compressionnozstd-fastBuild_Rush-specific. Cache-archive compression: zstd-fast (fastest) | zstd (balanced, better ratio) | none (uncompressed). See "Compression" below.

Outputs

OutputDescription
cache-hit"true" if an exact match for the primary key was found, otherwise "false".
buildrush-reasonReason code if a fallback was applied, empty string on success. See "Reason codes" below.

Inputs and outputs — buildrush/cache/restore@v1

Restore only. Same input names as actions/cache/restore@v5 plus the three Build_Rush-specific inputs.

InputRequiredDefaultNotes
keyyesPrimary key.
pathyesFiles / directories / patterns.
restore-keysnoOrdered fallback keys.
enableCrossOsArchivenofalseCross-OS restore.
fail-on-cache-missnofalseFail the step if no key matched.
lookup-onlynofalseCheck existence without downloading.
fallbacknogithubBuild_Rush-specific.
audiencenohttps://cache.buildrush.ioBuild_Rush-specific.
verbosenofalseBuild_Rush-specific. Verbose debug logging.
compressionnozstd-fastBuild_Rush-specific. zstd-fast | zstd | none. See "Compression".
OutputDescription
cache-hit"true" if exact key matched, else "false".
cache-primary-keyEcho of the input key.
cache-matched-keyMatched key (empty string on miss).
buildrush-reasonReason code if fallback was applied, empty string on success.

Inputs and outputs — buildrush/cache/save@v1

Save only. Same input names as actions/cache/save@v5 plus the three Build_Rush-specific inputs.

InputRequiredDefaultNotes
keyyesPrimary key.
pathyesFiles / directories / patterns.
enableCrossOsArchivenofalseCross-OS save.
upload-chunk-sizeno33554432 (32 MiB)Bytes per chunk.
fallbacknogithubBuild_Rush-specific.
audiencenohttps://cache.buildrush.ioBuild_Rush-specific.
verbosenofalseBuild_Rush-specific. Verbose debug logging.
compressionnozstd-fastBuild_Rush-specific. zstd-fast | zstd | none. See "Compression".
OutputDescription
buildrush-reasonReason code if fallback was applied, empty string on success.

Fallback behavior

If the Build_Rush cache service is unreachable, the fallback input chooses how to respond:

  • github (default) — emit a warning annotation and continue without a cached step. Subsequent steps see the action as a miss.
    • Annotation: ::warning::Build_Rush Cache unavailable — falling back to GitHub cache (reason: <code>)
  • skip — disable caching entirely for this step by exporting ACTIONS_CACHE_DISABLED=true. Other cache-aware actions later in the job will also no-op.
    • Annotation: ::warning::Build_Rush Cache unavailable — caching skipped for this step (reason: <code>)
  • fail — fail the workflow step.
    • Annotation: ::error::Build_Rush Cache unavailable — failing step (reason: <code>)

On success you'll see: ::notice::Using Build_Rush cache.

Compression

compression selects how the cache archive is compressed:

valuespeedratiowhen
zstd-fast(default)fastestgooddefault; best on CPU-bound runners
zstdfastbestnetwork-bound runners or very large caches, where a smaller upload/download wins
nonen/anonepayloads that are already compressed (images, archives), to skip wasted CPU

zstd-fast and zstd produce the same archive format, so they share a cache namespace and interoperate within a key — switching between them never invalidates existing caches. none uses a separate namespace: switching a workflow to or from none causes a one-time cache miss on the first run after the change.

Reason codes

When a fallback is applied, the annotation (and the buildrush-reason output) contains one of these codes:

CodeWhat it meansWhat to do
oidc-mint-failedWorkflow lacks permissions: id-token: write.Add the permission to your workflow YAML.
network-errorCouldn't reach cache.buildrush.io.Usually transient.
oidc-rejectedBuild_Rush rejected the OIDC token (signature/audience/issuer/expiry).Open a support ticket — this should not happen in normal operation.
installation-not-enabledCache is not enabled for your installation.Enable cache for your installation in the Build_Rush dashboard.
rate-limitedToo many requests.Back off; open a ticket if persistent.
service-unavailableBuild_Rush cache service is having a bad day.Check status.buildrush.io.

Troubleshooting

  • Always seeing oidc-mint-failed? Your workflow is missing permissions: id-token: write. Add it at workflow or job level.
  • Always seeing installation-not-enabled? Visit the Build_Rush dashboard and confirm cache is enabled for your installation.
  • Always seeing oidc-rejected? The audience or issuer doesn't match what we expect. Don't override BUILDRUSH_CACHE_URL — it's intended for self-tests only.

Versioning

We use SemVer with our own version numbers (not mirroring upstream actions/cache).

  • @v1 (floating) — recommended pinning. Auto-updates within v1.x.y.
  • @v1.0.0 (immutable) — pin if you need byte-for-byte stability.
  • No @main or @latest — both are unsupported.

A new major arrives only on a documented breaking change. See CONTRIBUTING.md for the full bump-rules contract.

How it works

This is a first-party Node 24 action that implements the Build_Rush cache protocol directly — there's no runtime dependency on @actions/cache and no vendor object-store SDK in the upload/download path. All blob I/O uses standard HTTP (PUT, GET, Content-Range, Range).

Three entry points share one auth implementation and one archive pipeline:

  1. buildrush/cache@v1 (combined) — Node action with restore as the main step and save as the post step.
  2. buildrush/cache/restore@v1 (split) — restore only.
  3. buildrush/cache/save@v1 (split) — save only.

The action mints a GitHub OIDC token, exchanges it at POST cache.buildrush.io/api/cache/auth/exchange for a Build_Rush-issued cache JWT, then makes REST calls (/api/cache/entries, /api/cache/entries/lookup, /api/cache/entries/finalize) using that JWT. Archives are tar + zstd via the tar npm package and Node 24's built-in node:zlib zstd.

Source lives in src/auth/, src/client/, src/archive/, src/transport/, and src/retry/. The action entry points are restore/src/main.ts and save/src/main.ts. Bundled outputs at dist/restore/index.js and dist/save/index.js.

Contributing

See CONTRIBUTING.md.

License

MIT.

About

Drop-in replacement for GitHub `actions/cache` - Cache dependencies and build outputs in GitHub Actions.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages