name: Cache prune # Keeps the repository inside its 10 GB Actions cache budget. A new Rust cache entry (a lockfile or # toolchain change makes one) leaves its predecessor behind until GitHub evicts the least recently # used entries, which can be one a run still needs. After each CI run on main, this deletes the # entries a newer one of the same family replaced, once nothing has used them since (craft-common-actions # actions/cache-prune). Other entries (apt packages, tool caches) stay. on: workflow_run: workflows: [CI] types: [completed] branches: [main] permissions: contents: read jobs: cache-prune: name: cache prune # A fork's pull request from a branch named main also matches `branches`. if: github.event.workflow_run.event != 'pull_request' timeout-minutes: 10 runs-on: ubuntu-24.04 permissions: actions: write steps: - name: Harden runner uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 with: egress-policy: audit # A failed pass warns; the next run's prune deletes what it missed. - name: Prune replaced cache entries uses: storytold/craft-common-actions/actions/cache-prune@main continue-on-error: true