File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 77 CARGO_TERM_COLOR : always
88 RUST_BACKTRACE : 1
99 MISE_ENV : ci
10+ SCCACHE_GHA_ENABLED : true
1011
1112jobs :
1213 build_and_test :
Original file line number Diff line number Diff line change 1+ # https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches
2+
3+ name : Cleanup github runner caches on closed pull requests
4+ on :
5+ pull_request :
6+ types :
7+ - closed
8+
9+ jobs :
10+ cleanup :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ actions : write
14+ steps :
15+ - name : Cleanup
16+ run : |
17+ echo "Fetching list of cache keys"
18+ cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
19+
20+ ## Setting this to not fail the workflow while deleting cache keys.
21+ set +e
22+ echo "Deleting caches..."
23+ for cacheKey in $cacheKeysForPR
24+ do
25+ gh cache delete $cacheKey
26+ done
27+ echo "Done"
28+ env :
29+ GH_TOKEN : ${{ github.token }}
30+ GH_REPO : ${{ github.repository }}
31+ BRANCH : refs/pull/${{ github.event.pull_request.number }}/merge
You can’t perform that action at this time.
0 commit comments