forked from singnet/Omega
-
Notifications
You must be signed in to change notification settings - Fork 1
29 lines (26 loc) · 766 Bytes
/
Copy pathcleanup.yml
File metadata and controls
29 lines (26 loc) · 766 Bytes
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
name: clean cache
on:
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Prune GHA Caches
run: |
echo "Fetching caches"
cacheKeys=($(gh cache list --ref $GH_REF --limit 100 --json id --jq '.[].id'))
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting ${#cacheKeys[@]} caches..."
for cacheKey in "${cacheKeys[@]}"
do
echo "Delete cache $cacheKey"
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
GH_REF: ${{ github.ref }}