From b097b7e9dede1ed860eb06219b38b74f0c20d28e Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:08:09 -0700 Subject: [PATCH] Make sccache read-only outside main PR runs filled the cache past its limit and evicted the main caches that every PR reads. PRs lose sccache reuse between pushes, but this is fine since PR entries were evicted within an hour anyway, so no big deal. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- .github/actions/setup-sccache/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/setup-sccache/action.yml b/.github/actions/setup-sccache/action.yml index a3130739e5..c950bf7e08 100644 --- a/.github/actions/setup-sccache/action.yml +++ b/.github/actions/setup-sccache/action.yml @@ -12,3 +12,8 @@ runs: run: | echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" + # Write the cache only on main. Other refs read it, since their + # entries serve only that ref and evict the ones main shares. + if [ "$GITHUB_REF" != "refs/heads/main" ]; then + echo "SCCACHE_GHA_RW_MODE=READ_ONLY" >> "$GITHUB_ENV" + fi