File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Cleanup Branch Cache
2+ on :
3+ pull_request :
4+ types :
5+ - closed
6+ workflow_dispatch :
7+
8+ jobs :
9+ cleanup :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Cleanup
13+ run : |
14+ gh extension install actions/gh-actions-cache
15+
16+ echo "Fetching list of cache key"
17+ cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
18+
19+ ## Setting this to not fail the workflow while deleting cache keys.
20+ set +e
21+ echo "Deleting caches..."
22+ for cacheKey in $cacheKeysForPR
23+ do
24+ gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
25+ done
26+ echo "Done"
27+ env :
28+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29+ REPO : ${{ github.repository }}
30+ BRANCH : refs/pull/${{ github.event.pull_request.number }}/merge
You can’t perform that action at this time.
0 commit comments