The latest stable release is 0.8.4.
Configuration Reference
The action is available in two build-tool-specific variants that share most inputs:
- Gradle —
buildish-tooling/buildish-mammoth-cache/actions/github/gradle@<sha> - Maven —
buildish-tooling/buildish-mammoth-cache/actions/github/maven@<sha>
All inputs described in Common inputs apply to both. Inputs described under Gradle-only inputs or Maven-only inputs are accepted only by the corresponding action and ignored (or rejected) by the other.
The following compact matrix is generated from the typed public contract. The detailed sections below add examples and rationale; the parity test ensures metadata, readers, config-file keys, runtime outputs, and these reference rows cannot silently diverge.
Canonical input matrix
| Input | Action | Default | Config file | Meaning |
|---|---|---|---|---|
config-file |
Gradle, Maven | event-dependent or unset |
no | Optional workspace-relative JSON or YAML configuration file. Direct action inputs override file values; secrets and GitHub context inputs are direct-only. |
base-directory |
Gradle, Maven | . |
yes | Repository-relative project base directory. Rooted paths and paths that escape the workspace are rejected. |
cache-enabled |
Gradle, Maven | true |
yes | Enables cache orchestration. Accepted values: true or false. |
read-only |
Gradle, Maven | event-dependent or unset |
yes | Disables cache and delta writes. Pull-request events default to true; repository config may make the policy stricter, but only a direct workflow input may lower that floor. |
job-mode |
Gradle, Maven | standalone |
yes | Cache coordination mode: standalone, distributed-worker, or distributed-aggregator. |
dependent-jobs |
Gradle, Maven | event-dependent or unset |
yes | Comma- or newline-separated worker job names consumed by a distributed aggregator. |
worker-artifact-retention-days |
Gradle, Maven | 7 |
yes | Requested worker artifact retention in whole days (1–400). Backend limits may shorten it; shorter retention narrows the retry window. |
allow-duplicate-dependent-delta-paths |
Gradle, Maven | false |
yes | Allows a distributed aggregator to resolve non-identical overlapping worker paths by newest modification time. Exact same-content overlaps remain safe without this option. |
cache-key-prefix |
Gradle, Maven | buildish-mammoth-cache- |
yes | Namespace prefix for action-owned cache families; build, partition, ref-lineage, and generation identity are appended automatically. |
cache-partitions |
Gradle, Maven | event-dependent or unset |
yes | JSON array of cache partition overrides and custom partitions. Hard safety exclusions remain non-overridable. |
cleanup-enabled |
Gradle, Maven | true |
yes | Enables restore cleanup and timestamp garbage collection. |
restore-cleanup-mode |
Gradle, Maven | none |
yes | Restore-time cleanup mode: none or prune-managed. |
cache-gc-mode |
Gradle, Maven | timestamp |
yes | Managed-cache GC: timestamp uses file age and current-build activity; off disables deletion only. |
cache-gc-older-than-days |
Gradle, Maven | 14 |
yes | File-mtime age threshold for timestamp GC, not historical inactivity. Must be at least 2 days. |
github-token |
Gradle, Maven | event-dependent or unset |
no | Optional GitHub token for authenticated API requests. Pass secrets directly, never through repository config. |
github-job-check-run-id |
Gradle, Maven | event-dependent or unset |
no | Optional check-run ID used to create a direct current-job link. |
github-event-name |
Gradle, Maven | event-dependent or unset |
no | Optional triggering-event override for reusable workflows. Pass the trusted caller event. |
github-job-name |
Gradle, Maven | event-dependent or unset |
no | Optional stable job-name override used for distributed artifact coordination. |
github-ref-name |
Gradle, Maven | event-dependent or unset |
no | Optional resolved-ref override for reusable workflows. |
github-default-branch |
Gradle, Maven | event-dependent or unset |
no | Optional repository default-branch override for reusable workflows. |
process-all-wrapper-files |
Gradle | false |
yes | Processes every matching Gradle wrapper properties file. Cannot be combined with wrapper-properties-files. |
wrapper-properties-glob |
Gradle | **/gradle/wrapper/gradle-wrapper.properties |
yes | Repository-relative Gradle wrapper properties discovery glob. |
wrapper-properties-files |
Gradle | event-dependent or unset |
yes | Comma- or newline-separated explicit Gradle wrapper properties files relative to base-directory. |
gradle-user-home |
Gradle | event-dependent or unset |
yes | Gradle user home to manage. The current version accepts only the runner default. |
setup-java |
Gradle | false |
yes | Reserved compatibility flag. The current version rejects true; run actions/setup-java first. |
maven-user-home |
Maven | event-dependent or unset |
yes | Absolute or working-directory-relative Maven user home to manage, including repository/ and wrapper/dists/; defaults to MAVEN_USER_HOME or ~/.m2. |
Canonical output matrix
| Output | Meaning |
|---|---|
cache-family-key |
Stable compatibility family shared by structurally compatible generations. |
cache-lineage-prefix |
Current-ref prefix used to restore the newest immutable generation. |
base-cache-restore-status |
Classified base-cache restore outcome for prepare. |
restored-cache-key |
Exact immutable generation restored during prepare, when any. |
read-only |
Whether cache and delta writes are disabled. |
job-mode |
Effective standalone or distributed job mode. |
dependent-delta-status |
Dependent-delta outcome: not-configured, applied, or skipped-read-only. |
dependent-delta-artifact-count |
Number of dependent worker artifacts applied during prepare. |
Common inputs
config-file
- Default: unset
- Optional workspace-relative
.json,.yml, or.yamlfile containing a top-level object. - Config-file keys use the same kebab-case names as the action inputs.
- Direct action inputs override values loaded from the file.
dependent-jobsandwrapper-properties-filesmay be either strings or arrays in the file.cache-partitionsmay be expressed as a native YAML/JSON array in the file instead of a serialized JSON string.github-tokenis intentionally rejected in config files; pass secrets directly via action inputs or environment variables.- The resolved file must remain inside the workspace after symlink resolution.
base-directory
- Default:
. - Repository-relative base directory for wrapper discovery and other project-relative paths.
- Windows-style relative paths using
\are accepted and normalized to internal POSIX-style paths. - Absolute/rooted paths are rejected, including
C:\repo,\Windows\System32, and\\server\share. - Must remain inside the repository workspace.
cache-enabled
- Default:
true - Accepted values:
true,false - Enables or disables cache orchestration.
read-only
- Default: event-dependent
- Accepted values:
true,false - Defaults to
trueforpull_request/pull_request_target. - Defaults to
falsefor other events. - A repository config file may set
true, but cannot setfalseto lower the pull-request safety floor. Only a direct workflow input can make that explicit trusted-workflow choice. - Prevents remote cache publication and workflow-artifact exchange.
- Finalize skips cache activity scans, publication snapshot capture and replay checks. Activity statistics are reported as unavailable; snapshot counts describe prepare, not post-build contents.
- Local restore/extraction, snapshot replacement and integrity validation, provisioning, hooks, build reports and bounded lifecycle records remain active. Local cache files remain writable.
job-mode
- Default:
standalone - Supported values:
standalonedistributed-workerdistributed-aggregator
- Controls cache coordination behavior.
dependent-jobs
- Default: empty
- Comma- or newline-separated job names.
- Only valid with distributed job modes.
worker-artifact-retention-days
- Default:
7 - Positive whole-number days from
1to400. Repository, organization, and backend limits may shorten the requested period; availability for the full period is not guaranteed. - Applies to new distributed worker artifact uploads for both Gradle and Maven. Producers may request different periods without affecting cache identity or envelope compatibility.
- Shorter retention reduces artifact residence and narrows the selective or aggregator-only retry window. Expired workers must be rerun before aggregation can succeed.
- Successful aggregation retains worker envelopes. Base cache expiry and timestamp GC are independent.
- For a one-day example, see distributed jobs.
cache-key-prefix
-
Default:
buildish-mammoth-cache- -
Must start with an alphanumeric character.
-
Remaining characters may only be letters, numbers,
.,_, or-. -
Changes only the namespace prefix. The action always appends build tool, schema, partition, storage-format, ref-lineage, and immutable-generation identity.
-
OS and architecture share by default for both tools. To isolate them, use a workflow input:
1cache-key-prefix: project-${{ runner.os }}-${{ runner.arch }}- -
Every participating worker and aggregator must resolve the same prefix to share. GitHub expressions belong in workflow YAML; config-file strings are literal.
-
Maven local installs with environment-dependent bytes at identical coordinates require distinct coordinates or an explicitly isolated prefix. Java versions share by default too; include a chosen Java identity in the prefix when needed.
cache-partitions
- Default: empty
- Optional JSON array of cache partition overrides and custom partitions.
- In
config-file, this may also be a native YAML/JSON array instead of a serialized string. - Each object must contain:
id: lowercase letters, numbers, and-onlyincludes: array of cache-root-relative include globsexcludes: optional array of cache-root-relative exclude globs
- Overriding a built-in partition replaces its built-in include/exclude lists.
- Setting
includes: []disables a built-in partition. - Custom partitions must have at least one include glob.
- Hard safety excludes are always enforced even when a partition is overridden.
cleanup-enabled
- Default:
true - Accepted values:
true,false - Enables restore cleanup and timestamp garbage collection. When
false, both are skipped even if their individual modes request cleanup.
cache-gc-mode
- Default:
timestamp - Supported values:
off,timestamp - Controls best-effort garbage collection of managed cache files before standalone or distributed-aggregator jobs save the base cache.
timestampdeletes old-mtime files without activity protection during this build.- Activity uses ctime/mtime/atime crossing the post-prepare cutoff. No historical last-use grace is stored; filesystem/clock misses can cause redownloads.
offdisables deletion only, retaining tracking, exchange and otherwise required publication.- Set
offwhen jobs must retain rarely used old cache entries, for example offline-style builds that cannot redownload pruned dependencies.
cache-gc-older-than-days
- Default:
14 - Minimum:
2 - Age threshold for
cache-gc-mode: timestamp. - Grace measures file age, not historical inactivity. Deferred/coalesced atime and
noatimecan hide current use. - Increase this value if your Gradle or Maven build uses a large dependency set with artifacts that are valid but touched infrequently.
restore-cleanup-mode
- Default:
none - Supported values:
none,prune-managed prune-managedonly acts after a base-cache hit.- It deletes files currently matched by the active managed partitions, then restores the exact selected generation and its originally available partition objects again. A previously available object disappearing during replay fails prepare; an originally missing partition remains cold.
- It never deletes files outside the action-managed partition space.
- It is intentionally an opt-in because it is more destructive and may increase restore time.
allow-duplicate-dependent-delta-paths
- Default:
false - Accepted values:
true,false - When
true, the aggregator resolves non-identical overlapping worker paths by newest modification time. - Exact same-content overlaps merge safely without this option.
- When
false, non-identical path conflicts are errors. - Only relevant for distributed aggregator jobs.
For Maven files under repository/, directory consistency takes precedence: workers updating the
same directory must provide identical managed path sets, content, and sizes by default. This option
cannot select a newer conflicting origin marker or combine different directory views. See
Maven caching patterns.
Partition publication and metadata writers
The existing cache-partitions input also accepts publication and writer on individual entries.
Gradle’s enabled dependency-metadata preset defaults to single-writer; other partitions use
aggregate. A standalone job is automatically its own writer. For distributed jobs, put this same
configuration in every participating job, preferably using a shared config file:
1cache-partitions:
2 - id: dependency-metadata
3 writer: worker-a
Omit includes and excludes to inherit the built-in patterns. Explicit lists replace the
corresponding defaults; an empty include list disables a built-in. Custom partitions must supply
nonempty includes and can opt into publication: single-writer with their own writer.
A writer is a trimmed producer identity, including an explicit github-job-name when supplied.
Matrix jobs must have distinct producer identities.
writer identifies an optional snapshot contribution. It does not make an entry in
dependent-jobs optional. If a job is also listed there for ordinary artifacts, its envelope remains
required. See the distributed guide for complete
workflows, skipped writers, fallback, and configuration compatibility.
Partition conflict handling
Each cache-partitions entry accepts conflict-handling: default,
choose-worker-directory, or choose-worker-entry. Omission inherits the preset
policy. The built-in Gradle groovy-dsl, kotlin-dsl and transforms-metadata partitions default to
choose-worker-directory; build-cache defaults to choose-worker-entry.
Other built-ins and custom partitions default to strict handling. Explicit
default clears an inherited selection policy.
1cache-partitions:
2 - id: repository
3 conflict-handling: choose-worker-directory
choose-worker-directory supports aggregate Maven partitions whose include
globs all start with repository/, and aggregate Gradle partitions whose includes select DSL/transform workspaces or the
ordinary legacy-script/generated-API-JAR paths in the built-in Kotlin partition.
Selection applies only to recognized workspace roots; ordinary files remain strict. Configure the same
policy in every producer and aggregator. The effective policy changes the partition
fingerprint and cache family.
For Gradle DSL and transform caches, the unit is the complete hashed workspace, including its
metadata, output files and empty output directories. Groovy requires both metadata
files; Kotlin uses its layout-specific required outputs; transforms require nonempty
metadata.bin, regular results.bin and transformed/. Conflicting producers are selected
by the job-name ordering below. Losing views are discarded. The selected complete
workspace replaces existing managed contents; excluded or unmanaged target
obstacles fail before replacement. Partial-workspace overrides and single-writer
publication are unsupported. default keeps whole-workspace transport but rejects
conflicting views. See cache partitions for capture and GC.
choose-worker-entry supports aggregate Gradle build-cache partitions with
includes rooted at caches/build-cache-*/ or a literal numeric format directory.
It selects one unchanged archive per direct 32-lowercase-hex key under
caches/build-cache-<number>/. Other filenames retain ordinary strict handling.
Different keys can come from different producers. Both Gradle selection policies
use the smallest producer job name in JavaScript UTF-16 ordinal order, independent
of package arrival and modification times, and take precedence over
allow-duplicate-dependent-delta-paths. Explicit strict overrides also take
precedence for recognized workspace/archive collisions.
These policies also select a winner if actual outputs differ under the same key.
They assume correctly declared, reproducible Gradle work; Mammoth does not compare
archive contents semantically or rewrite origin metadata. Use default to reject
such conflicts. Portable file permissions still apply to the selected view.
For Maven, the following directory rules apply.
For each immediate repository directory, choose the complete contribution from the producer with the smallest job name in JavaScript UTF-16 ordinal order. Discovery first selects each producer’s newest eligible attempt. File arrival order, modification times and attempt numbers across different producers do not set priority. Differing directory membership counts as a conflict too.
The winner supplies all files and their attributes, subject to normal portable
permissions. Other producers’ files for that directory are discarded. Marker
contents are neither parsed nor merged. This directory policy takes precedence
over allow-duplicate-dependent-delta-paths. Usage-only contributions cannot win.
Directories spanning partitions must use one consistent policy; single-writer
snapshot partitions cannot use this mode.
Selection can lose classifiers, origin entries or local installs supplied only by another worker. Offline builds may fail, and a discarded local install may have no remote copy. Different directories may select different workers, so this is not a snapshot of the entire Maven repository. A forwarding worker republishes its selected view under its own job identity; priority is per merge stage.
Existing aggregator files absent from the winning directory still cause an error before worker upserts, including files excluded from caching. This mode does not delete target siblings or add exact directory replacement. Diagnostics report resolved conflicts with bounded winner/discarded-producer details.
github-token
- Default: unset (falls back to
GITHUB_TOKENwhen available) - Used for authenticated requests to the configured GitHub API host. The Gradle action uses these headers for authenticated wrapper downloads; provider integrations may also use them.
- Direct-only: config files reject this secret-bearing input.
- Never written to summaries or persisted post-action state.
github-event-name
- Default: unset (the action reads
GITHUB_EVENT_NAMEfrom the runner environment) - Reusable workflows only. When a workflow is triggered via
workflow_call, GitHub setsGITHUB_EVENT_NAMEtoworkflow_callrather than the original caller’s event name. Pass${{ github.event_name }}from the caller workflow to restore the correct value. - Affects
isPullRequestdetection and the default read-only behavior on pull-request events. - Example:
1github-event-name: ${{ github.event_name }}
github-job-name
- Default: unset (the action reads
GITHUB_JOBfrom the runner environment) - Reusable workflows and matrix jobs. Assigns a stable, predictable job name for cache coordination and artifact naming, independent of the GitHub Actions job key or matrix label.
- Example:
1github-job-name: aggregator
github-ref-name
- Default: unset (the action resolves the ref name from
GITHUB_REF_NAME,GITHUB_REF, and the event payload) - Reusable workflows only. When a workflow is triggered via
workflow_call, the ref context visible inside the reusable workflow may differ from the caller’s. Pass the resolved ref name from the caller workflow to ensure cache keys use the correct branch or tag. - Example:
1github-ref-name: ${{ github.ref_name }}
github-default-branch
- Default: unset (the action reads the default branch from the event payload or
GITHUB_DEFAULT_BRANCH) - Reusable workflows only. Pass the caller’s default branch so that cache key fallbacks target the correct base branch.
- Example:
1github-default-branch: ${{ github.event.repository.default_branch }}
Outputs
Both actions expose the same cache lifecycle outputs after prepare:
| Output | Meaning |
|---|---|
cache-family-key |
Structural compatibility family, without ref or generation identity |
cache-lineage-prefix |
Current-ref prefix used for newest-generation restore |
base-cache-restore-status |
feature-unavailable, miss, current-lineage-hit, fallback-lineage-hit, current-lineage-partial-hit, or fallback-lineage-partial-hit |
restored-cache-key |
Selected generation with at least one restored/explicit-empty partition, or empty on a miss |
read-only |
Effective write policy as true or false |
job-mode |
Effective standalone or distributed mode |
dependent-delta-status |
not-configured, applied, or skipped-read-only |
dependent-delta-artifact-count |
Number of worker artifacts applied during prepare |
Generation keys are finalize outcomes and are intentionally not planned prepare outputs. The job summary and finalize log report the exact key only after a successful publication.
Gradle-only inputs
process-all-wrapper-files
- Default:
false - Accepted values:
true,false - Scans for every matching wrapper properties file under
base-directory. - Cannot be combined with
wrapper-properties-files.
wrapper-properties-glob
- Default:
**/gradle/wrapper/gradle-wrapper.properties - Repository-relative discovery glob used beneath
base-directory. - Windows-style relative paths using
\are accepted and normalized before evaluation. - Absolute/rooted paths are rejected, including drive-prefixed, rooted, and UNC paths.
wrapper-properties-files
- Default: empty
- Comma- or newline-separated explicit
gradle-wrapper.propertiesfiles. - Paths are relative to
base-directory. - Windows-style relative paths using
\are accepted and normalized to internal POSIX-style paths. - Absolute/rooted paths are rejected, including drive-prefixed, rooted, and UNC paths.
- Entries must be explicit file paths, not globs.
gradle-user-home
- Default:
$GRADLE_USER_HOMEwhen set, otherwise$HOME/.gradle - In v1, only the default Gradle user home is supported. Non-default values fail validation intentionally.
setup-java
- Default:
false - Reserved compatibility flag. In v1, setting
truefails intentionally. - Run
actions/setup-javabefore this action instead.
Maven-only inputs
maven-user-home
- Default:
$MAVEN_USER_HOMEwhen set, otherwise$HOME/.m2 - Accepts an absolute path or a path resolved from the action process working directory.
- The managed root contains both the Maven local repository at
repository/and Maven Wrapper distributions atwrapper/dists/; do not pass therepository/directory itself. - Operators are responsible for ensuring a custom user home contains only intended Maven cache state and is not shared across trust zones.
Distributed mode wiring example
The snippets below show the minimum input wiring needed to connect two worker jobs to an
aggregator. The github-job-name input gives each job a stable, human-readable name that is
independent of matrix labeling; the aggregator’s dependent-jobs must list exactly those names.
See Distributed Multi-Job Builds for a full explanation of how the delta exchange works and for additional configuration options.
Gradle
1jobs:
2 worker-a:
3 runs-on: ubuntu-latest
4 permissions:
5 contents: read
6 steps:
7 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
8 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
9 with: { distribution: temurin, java-version: '21' }
10 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/gradle@<commit-sha>
11 with:
12 job-mode: distributed-worker
13 github-job-name: worker-a # stable name used by the aggregator
14 cache-key-prefix: my-project-gradle-
15 - run: ./gradlew :module-a:build
16
17 worker-b:
18 runs-on: ubuntu-latest
19 permissions:
20 contents: read
21 steps:
22 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
23 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
24 with: { distribution: temurin, java-version: '21' }
25 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/gradle@<commit-sha>
26 with:
27 job-mode: distributed-worker
28 github-job-name: worker-b
29 cache-key-prefix: my-project-gradle-
30 - run: ./gradlew :module-b:build
31
32 aggregator:
33 needs: [worker-a, worker-b]
34 if: ${{ always() && github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
35 runs-on: ubuntu-latest
36 permissions:
37 contents: read
38 steps:
39 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
40 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
41 with: { distribution: temurin, java-version: '21' }
42 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/gradle@<commit-sha>
43 with:
44 job-mode: distributed-aggregator
45 dependent-jobs: worker-a, worker-b # must match github-job-name on each worker
46 github-job-name: aggregator
47 cache-key-prefix: my-project-gradle-
Maven
1jobs:
2 worker-a:
3 runs-on: ubuntu-latest
4 permissions:
5 contents: read
6 steps:
7 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
8 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
9 with: { distribution: temurin, java-version: '21' }
10 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/maven@<commit-sha>
11 with:
12 job-mode: distributed-worker
13 github-job-name: worker-a
14 cache-key-prefix: my-project-maven-
15 - run: mvn -pl module-a verify
16
17 worker-b:
18 runs-on: ubuntu-latest
19 permissions:
20 contents: read
21 steps:
22 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
23 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
24 with: { distribution: temurin, java-version: '21' }
25 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/maven@<commit-sha>
26 with:
27 job-mode: distributed-worker
28 github-job-name: worker-b
29 cache-key-prefix: my-project-maven-
30 - run: mvn -pl module-b verify
31
32 aggregator:
33 needs: [worker-a, worker-b]
34 if: ${{ always() && github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
35 runs-on: ubuntu-latest
36 permissions:
37 contents: read
38 steps:
39 - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
40 - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
41 with: { distribution: temurin, java-version: '21' }
42 - uses: buildish-tooling/buildish-mammoth-cache/actions/github/maven@<commit-sha>
43 with:
44 job-mode: distributed-aggregator
45 dependent-jobs: worker-a, worker-b
46 github-job-name: aggregator
47 cache-key-prefix: my-project-maven-