We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d32d025 commit 12cfc16Copy full SHA for 12cfc16
.github/workflows/cache-cleanup-weekly.yml
@@ -0,0 +1,29 @@
1
+name: Purge caches once a week
2
+on:
3
+ schedule:
4
+ # 4:10 UTC on Sunday
5
+ - cron: "10 4 * * 0"
6
+
7
+jobs:
8
+ cleanup:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Clean Cache
12
+ run: |
13
+ gh extension install actions/gh-actions-cache
14
15
+ REPO=${{ github.repository }}
16
17
+ echo "Fetching list of cache key"
18
+ allCaches=$(gh actions-cache list -L 100 -R $REPO | cut -f 1 )
19
20
+ ## Setting this to not fail the workflow while deleting cache keys.
21
+ set +e
22
+ echo "Deleting caches..."
23
+ for cacheKey in $allCaches
24
+ do
25
+ gh actions-cache delete $cacheKey -R $REPO --confirm
26
+ done
27
+ echo "Done"
28
+ env:
29
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
0 commit comments