A GitHub Action for Linux workflows. It restores and saves Bazelisk, Bazel disk, and downloaded repository caches. It can also cache large extracted external repositories and report cache reuse. It does not configure a remote cache.
Use it when CI needs to reuse dependency downloads, preserve cache generations, or show whether Bazel reused build and test results.
Run checkout first, then add the action before your Bazel commands:
steps:
- uses: actions/checkout@<sha>
- uses: eclipse-score/cicd-actions/setup-bazel-cache@<sha>
with:
disk-cache-key: ${{ github.job }}
- run: bazel test //...Keep disk-cache-key stable between runs. Add matrix values when jobs need
separate disk caches. github.job can be used to share a cache across callers
of the same reusable workflow.
-
disk-cache-key- Options: Required string of 1–400 printable characters, without commas.
Use a stable value to identify the disk cache for this job. Add matrix values when jobs need separate caches. For a matrix example, see Use the action in a build matrix.
-
cache-save-branch-patterns- Options: Empty (default), or newline-separated branch names and glob patterns.
Empty allows only the repository's default branch to save. Set patterns to allow other branches, and include the default branch if it should remain allowed; pull-request refs and tags cannot save caches.
-
token- Options:
${{ github.token }}(default) or another GitHub token.
Supply a token with
actions: writeif the action should remove obsolete disk or repository cache generations after an upload. Uploads work without that permission. - Options:
-
disk-cache-restore- Options:
auto(default),true,false.
autoskips the existing cache when the module lockfile changed and this run may save.truealways attempts restore;falseskips it. - Options:
-
disk-cache-save- Options:
true(default),false.
Set
falseto prevent disk-cache uploads from this job. Saving is still limited by the branch policy. - Options:
-
repository-cache-restore- Options:
auto(default),true,false.
autoskips the old cache whenMODULE.bazel.lockchanged and this run may save, so the next generation starts with downloads for the new dependencies.truealways attempts restore;falseskips it. This setting does not control the separate extracted-repository cache. See automatic restore behavior. - Options:
-
repository-cache-save- Options:
auto(default),true,false.
autoseeds an empty or lockfile-reset cache and saves after the configured growth threshold.truesaves every eligible non-empty run;falsedisables uploads. - Options:
-
repository-cache-growth-threshold- Options: Integer from
0to100(default:10).
Used when
repository-cache-saveisauto. Set it to0to save after any positive growth, including small additions from flaky downloads. - Options: Integer from
-
bazelisk-cache-restore- Options:
true(default),false.
Set
falseto download the selected Bazel version again instead of restoring it from cache. - Options:
-
bazelisk-cache-save- Options:
true(default),false.
Set
falseto stop saving downloaded Bazel versions for later runs. - Options:
-
external-cache-restore- Options:
true(default),false.
Set
falseto skip restoring large extracted repositories under Bazel's output base. - Options:
-
external-cache-save- Options:
true(default),false.
Set
falseto stop saving extracted repositories. These caches are saved only after a successful job. - Options:
-
report-cache-hits- Options:
true(default),false.
Set
falseto disable build/action cache reporting forbuild,run,test, andcoverageinvocations. - Options:
-
report-test-cache-hits- Options:
true(default),false.
Set
falseto disable test-result reporting fortestandcoverage. Reporting does not enable Bazel's test-result cache. - Options:
-
report-cache-step-summary- Options:
true,false(default).
Set
trueto also write enabled reports to the GitHub Actions step summary. - Options:
-
enable-profiling- Options:
auto(default),true,false.
autocaptures profiles when Actions debug logging is enabled;truecaptures profiles on every run andfalsedisables profiling. Captured profiles are uploaded as a job artifact. - Options:
The reference covers detailed behavior and input interactions.
| Output | Meaning |
|---|---|
cache-save-branch-evaluated |
true when this ref is allowed to save caches, otherwise false. |
bazelisk-cache-restored |
true when a Bazelisk cache was restored, otherwise false. |
disk-cache-restored |
true when a disk cache was restored, otherwise false. |
repository-cache-restored |
true when a downloaded repository cache was restored, otherwise false. |
external-cache-restored |
true when the manifest and every repository it lists were restored, otherwise false. |
- How-to: use caches in a build matrix, warm a shared repository cache, and allow selected branches to publish.
- Reference: input defaults, accepted values, outputs, and permissions.
- Explanation: how cache restore and save decisions work, what reports measure, and how cache storage is managed.