Skip to content

Commit 2ed023c

Browse files
authored
Fix cache clearing job (#4868)
On merge github.ref points to master thus attempting to clear cache of master. This commit fixes it with proper referencing + adds write permissions.
1 parent 0c450cb commit 2ed023c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/clear-cache.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ on:
99
jobs:
1010
cleanup:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
actions: write
1214
steps:
1315
- name: Cleanup caches for closed PR
1416
# remove all cache entries for this PR
1517
# caches usability hierarchy : master → PR
1618
# other PRs / master cannot reuse them
1719
# so clear them when the PR is closed or merged
1820
run: |
19-
gh cache list --ref ${{ github.ref }} --json id \
21+
gh cache list --ref refs/pull/${{ github.event.pull_request.number }}/merge --json id \
2022
| jq -r '.[].id' \
2123
| xargs -I{} gh cache delete {}
2224
env:

0 commit comments

Comments
 (0)