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 2943b16 commit 3afe146Copy full SHA for 3afe146
.github/workflows/cleanup-caches.yml
@@ -0,0 +1,29 @@
1
+name: Cleanup github runner caches on closed pull requests
2
+on:
3
+ pull_request:
4
+ types:
5
+ - closed
6
+
7
+jobs:
8
+ cleanup:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ actions: write
12
+ steps:
13
+ - name: Cleanup
14
+ run: |
15
+ echo "Fetching list of cache keys"
16
+ cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
17
18
+ ## Setting this to not fail the workflow while deleting cache keys.
19
+ set +e
20
+ echo "Deleting caches..."
21
+ for cacheKey in $cacheKeysForPR
22
+ do
23
+ gh cache delete $cacheKey
24
+ done
25
+ echo "Done"
26
+ env:
27
+ GH_TOKEN: ${{ github.token }}
28
+ GH_REPO: ${{ github.repository }}
29
+ BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
0 commit comments