We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0b694f commit dad7e3dCopy full SHA for dad7e3d
.github/workflows/cleanup_largest_caches.yml
@@ -0,0 +1,32 @@
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 }}
0 commit comments