Skip to content

Commit 0d3a26f

Browse files
authored
ci: auto delete cache (OpenAtomFoundation#2232)
1 parent 31b9380 commit 0d3a26f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/clean-cache.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Cleanup Caches By a Branch
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Cleanup
12+
run: |
13+
gh extension install actions/gh-actions-cache
14+
for cacheKey in $(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
15+
do
16+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm &
17+
done
18+
wait
19+
env:
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
REPO: ${{ github.repository }}
22+
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge

0 commit comments

Comments
 (0)