Repository navigation
fix: image publishes write the Docker cache only on a default-branch push - #191
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
#189 stopped pull requests from writing caches, but
container-publishandcrac-trainstill wrote theirs on every run. Repositories publish from a tag push, and a cache written under a tag's ref can be restored by no later run: the next release has a different tag, and a run can restore only from its own ref or the default branch.hindsight shows the cost. It publishes three images per tag, and on 2026-10-21 it held 12.9 GB of cache, over the 10 GB limit.
mainheld 2.7 GB, and v1.0.3, v1.0.4 and v1.1.0 each held about another 2–2.7 GB of the same layers.What
In both workflows
cache-from: type=ghastays, andcache-tois empty unless the run is a push to the default branch. This is the same expression #189 uses.A tag-only publisher now writes no Docker cache at all. Its builds lose only what they could already use: a re-run of the same tag.
Tests
The rule is held for both workflows in
tests/test_caches_save_only_on_default_branch.py. The two new tests failed before the change. The full suite and actionlint pass.