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 d37ed35 commit 9661f94Copy full SHA for 9661f94
.github/workflows/cleanup-cache.yml
@@ -0,0 +1,29 @@
1
+---
2
+name: cleanup branch caches
3
+
4
+on:
5
+ pull_request:
6
+ types:
7
+ - closed
8
9
+jobs:
10
+ cleanup:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - run: gh extension install actions/gh-actions-cache
14
15
+ - name: Cleanup
16
+ run: |
17
+ cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1)
18
19
+ # Turn off errexit to not fail the workflow while deleting cache keys.
20
+ set +e
21
+ echo "Deleting caches..."
22
+ for cacheKey in $cacheKeysForPR
23
+ do
24
+ gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
25
+ done
26
+ env:
27
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+ REPO: ${{ github.repository }}
29
+ BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
0 commit comments