A commandline tool that packs and restores your Gradle cache in CI builds
// readme
Bundle Cache Tool
A CLI tool for saving and restoring Gradle build cache bundles, with a ready-to-use GitHub Action.
Bundles are stored keyed by commit SHA, so restore doesnβt need to know
exactly which commit produced a given bundle. Instead, it walks local git
history and tries each commit SHA in order, newest first, until it finds a
bundle that exists. By default it walks from a given ref (default: HEAD);
when restoring for a branch or pull request, it first resolves the merge-base
of HEAD and the base ref, then walks from that common ancestor. This lets a
feature branch restore a bundle compatible with its base without needing to
know the SHA in advance.
The history walk counts distinct author-change boundaries rather than raw commit count, so a long run of commits by the same author only consumes one step of the search budget. The default search depth is 20 such boundaries.
GitHub Action
The easiest way to use gradle-cache in CI is with the GitHub Action. It stores cache bundles in the GitHub Actions cache (no S3 required) and handles restore/save automatically. Place the action before your Gradle build step:
jobs:
build:
runs-on:β¦