Skip to content

Schedule cleanup of stale julia caches on long-lived branches#14414

Merged
cderv merged 2 commits intomainfrom
feature/cleanup-main-caches
Apr 23, 2026
Merged

Schedule cleanup of stale julia caches on long-lived branches#14414
cderv merged 2 commits intomainfrom
feature/cleanup-main-caches

Conversation

@cderv
Copy link
Copy Markdown
Member

@cderv cderv commented Apr 23, 2026

Julia caches accumulate without bound on main and v1.9. Each run creates a new cache (the key includes run_id), but julia-actions/cache@v3's delete-old-caches step 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 !isDefaultBranch in src/post.js, so delete-old-caches: true is a no-op on main. The existing cleanup-caches.yml only triggered on pull_request_target, so long-lived branches had no cache lifecycle at all.

Fix

Add a cleanup-branches matrix job to cleanup-caches.yml that runs daily (04:00 UTC) and on workflow_dispatch. For each of refs/heads/main and refs/heads/v1.9, it groups julia caches by (workflow, os) (the key prefix before run_id=), keeps the newest per group, and deletes the rest.

The existing PR-close job is split into cleanup-pr with a matching if: guard so the new matrix job only fires on schedule/dispatch.

cderv added 2 commits April 23, 2026 12:39
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.
@cderv cderv merged commit d5c1f1d into main Apr 23, 2026
51 checks passed
@cderv cderv deleted the feature/cleanup-main-caches branch April 23, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant