-
-
Notifications
You must be signed in to change notification settings - Fork 344
55 lines (50 loc) · 1.32 KB
/
cache-clean.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Cache clean
on:
workflow_dispatch:
inputs:
clean_opt:
description: 'Level of cleaning required'
type: choice
default: push-requests
options:
- pull-requests
- ccache
- idf-tools
- ccache+idf
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache keys"
case $CLEAN_OPT in
pull-requests)
filter="-v develop"
;;
ccache)
filter="ccache"
;;
idf-tools)
filter="idf"
;;
ccache+idf)
filter="ccache\|idf"
;;
*)
echo "Unknown option '$CLEAN_OPT'"
exit 1
;;
esac
cacheKeys=$(gh actions-cache list -R $REPO -L 100 | grep $filter | cut -f 1 )
echo "Deleting caches..."
set +e
for cacheKey in $cacheKeys; do
gh actions-cache delete "$cacheKey" -R "$REPO" --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
CLEAN_OPT: ${{ inputs.clean_opt }}