From 5fd6f6bff1602fbc520780cbfd5ca40f1b326334 Mon Sep 17 00:00:00 2001 From: ada Date: Tue, 17 Feb 2026 23:51:31 -0600 Subject: [PATCH] ops: fix sccache ci; add cleanup action --- .github/workflows/ci.yml | 1 + .github/workflows/cleanup.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 089f283..eaee6d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 MISE_ENV: ci + SCCACHE_GHA_ENABLED: true jobs: build_and_test: diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000..b3fbff5 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,31 @@ +#https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches + +name: Cleanup github runner caches on closed pull requests +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Cleanup + run: | + echo "Fetching list of cache keys" + cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh cache delete $cacheKey + done + echo "Done" + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge -- 2.51.2