File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Cleanup lages 100 caches
2+
3+ on :
4+ workflow_dispatch :
5+
6+ permissions :
7+ contents : read
8+ packages : read
9+ actions : write
10+
11+ jobs :
12+ cleanup :
13+ name : Delete caches when PR is closed
14+ runs-on : ubuntu-24.04
15+
16+ steps :
17+ - name : Cleanup largest 100 caches
18+ run : |
19+ echo "Fetching list of cache key"
20+ cacheKeysLargest=$(gh cache list -R $REPO --limit 100 --sort size_in_bytes --order desc| cut -f 1 )
21+
22+ ## Setting this to not fail the workflow while deleting cache keys.
23+ set +e
24+ echo "Deleting caches..."
25+ for cacheKey in $cacheKeysLargest
26+ do
27+ gh cache delete $cacheKey -R $REPO -B $BRANCH --confirm
28+ done
29+ echo "Done"
30+ env :
31+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32+ REPO : ${{ github.repository }}
You can’t perform that action at this time.
0 commit comments