Skip to content

chore(state): record Phase 17 merge to main #32

chore(state): record Phase 17 merge to main

chore(state): record Phase 17 merge to main #32

Workflow file for this run

# .github/workflows/cleanup-cache.yml
# Delete GitHub Actions caches tied to a PR's merge ref when that PR is closed
# (merged or not). Prevents the 10 GB GHA cache quota from filling with stale
# multi-arch Rust build caches on a long-lived OSS project.
#
# Source of inspiration:
# https://github.com/SimplicityGuy/discogsography/blob/main/.github/workflows/cleanup-cache.yml
#
# The `set +e` around the delete loop is intentional: if a cache has already
# been evicted (expiry) or deleted by another run, we want the workflow to
# continue deleting the rest rather than aborting.
name: Cleanup Cache
on:
pull_request:
types:
- closed
concurrency:
group: cleanup-cache-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
cleanup:
name: delete PR caches
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: write
steps:
- name: Cleanup Cache
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
echo "Fetching list of cache keys for $BRANCH"
cacheKeysForPR=$(gh cache list --ref "$BRANCH" --limit 100 --json id --jq ".[].id")
# set +e on purpose: a cache already-evicted by expiry or a
# concurrent delete must not fail the run.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete "$cacheKey"
done
echo "Done"