Skip to content

Commit 2b025d5

Browse files
authored
Fix Julia cache flood in CI workflows (#14410)
* Bump julia-actions/cache to v3 v2 is a composite action whose post-save and delete-old-caches steps don't run reliably, letting per-run julia caches (~250 MB each) accumulate on refs/heads/main until the repository hits its 10 GB cache cap. v3 is a JavaScript rewrite with a proper post hook. It also uses Node.js 24 directly, dropping the latent Node 20 exposure from v2's transitive actions/cache dependency. * Fix cleanup-caches workflow for fork PRs pull_request events from forks ship a read-only GITHUB_TOKEN regardless of the permissions: block, so gh cache delete fails with HTTP 403 and the fork PR's ~1-2 GB of caches leak into the repo's 10 GB cache budget. Observed on PR #14374 (8/8 deletes returned 403, run succeeded because set +e swallowed the failures). pull_request_target runs in the base-branch context with full write permissions. Safe for this workflow: no PR code is checked out, the steps only call gh cache list/delete.
1 parent 266a416 commit 2b025d5

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/cleanup-caches.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Cleanup github runner caches on closed pull requests
22
on:
3-
pull_request:
3+
# pull_request_target is required so fork PRs can delete their own caches on close.
4+
# pull_request from a fork ships a read-only GITHUB_TOKEN regardless of the
5+
# permissions: block, causing gh cache delete to fail with HTTP 403.
6+
# Safe here: no PR code is checked out, the workflow only calls gh cache list/delete.
7+
pull_request_target:
48
types:
59
- closed
610

.github/workflows/test-smokes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
version: "1.12.5"
224224

225225
- name: Load Julia packages from cache
226-
uses: julia-actions/cache@v2
226+
uses: julia-actions/cache@v3
227227
with:
228228
cache-name: julia-cache;workflow=${{ github.workflow }};job=${{ github.job }};julia=${{ steps.setup-julia.outputs.julia-version }}
229229

0 commit comments

Comments
 (0)