Schedule cleanup of stale julia caches on long-lived branches#14414
Merged
Schedule cleanup of stale julia caches on long-lived branches#14414
Conversation
julia-actions/cache@v3 intentionally skips delete-old-caches on the default branch, so caches on main and v1.9 accumulate without bound. Add a daily matrix job that keeps the newest julia cache per (workflow, os) tuple and deletes the rest.
Non-julia caches could otherwise fill the first 100 rows of gh cache list and push stale julia entries out of the window, leaving them uncleaned.
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.
Julia caches accumulate without bound on
mainandv1.9. Each run creates a new cache (the key includesrun_id), butjulia-actions/cache@v3'sdelete-old-cachesstep intentionally skips the default branch to avoid races between concurrent runs. Since #14410 merged, main picked up another ~2.7 GB of stale julia caches in under 24 hours — trending back toward the 10 GB repo cap.Root Cause
v3 guards the cleanup step with
!isDefaultBranchinsrc/post.js, sodelete-old-caches: trueis a no-op on main. The existingcleanup-caches.ymlonly triggered onpull_request_target, so long-lived branches had no cache lifecycle at all.Fix
Add a
cleanup-branchesmatrix job tocleanup-caches.ymlthat runs daily (04:00 UTC) and onworkflow_dispatch. For each ofrefs/heads/mainandrefs/heads/v1.9, it groups julia caches by(workflow, os)(the key prefix beforerun_id=), keeps the newest per group, and deletes the rest.The existing PR-close job is split into
cleanup-prwith a matchingif:guard so the new matrix job only fires on schedule/dispatch.