Repository navigation
fix: only a push to the default branch saves the Gradle, Node, Docker and mise caches - #189
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Each repository holds 10 GB of Actions cache, and GitHub evicts the least recently used past that. A pull request can restore only its own caches or the default branch's. When every pull request saves its own, the default branch's get evicted and later pull requests start cold.
On 2026-10-21 the estate held 944 pull-request caches, about 61 GB, and several repositories sat at their 10 GB limit. Those caches were deleted by hand; without this change they come back within days. identity#150 fixed the same thing for identity's own workflow, and its first run afterwards restored
main's cache and saved none of its own.What
actions/setup-java-gradlegradle-cache-read-onlydefaulted to'false', overriding setup-gradle's own default, so every pull request wrote Gradle cachesactions/setup-nodesetup-nodecached on every runsetup-node's cache. Other runs locate the package-manager cache and restore the default branch's latestnode-cache-<os>-<arch>-<pm>-entry withactions/cache/restore, saving nothingdocker-image-ci.ymlcache-to: type=ghaon every buildcache-tois empty unless this is a default-branch push.cache-fromis unchangedmutation-report.ymlcache_save: false. The workflow runs only on pull requestsThe inputs used exist in the pinned versions: mise-action v5.2.0
cache_save, setup-node v6package-manager-cache, setup-gradle v6cache-read-only.Tests
tests/test_caches_save_only_on_default_branch.pyholds the rule per producer, 6 tests. They failed before the change: 4 failures, 2 errors. The full suite passes, 250 tests, and actionlint passes.Rollout
Consumers pin this repository by tag, so the change reaches them through the release this PR cuts and the Renovate bump after it. Workflows that repositories carry themselves, such as grimoire's and estate-dashboard's mise caches, are not covered here.