Skip to content

Commit

Permalink
Fix cache cleanup script (now tested to work) (#999)
Browse files Browse the repository at this point in the history
* Try fix suggested in github/docs#31322
* Add `actions: write` permission
  • Loading branch information
corneliusroemer authored Feb 12, 2024
1 parent dd95149 commit cc80095
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/clean-cache-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
name: cleanup caches by a branch
on:
pull_request:
pull_request_target:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup
run: |
Expand All @@ -22,10 +25,11 @@ jobs:
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
echo "Deleting $cacheKey"
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
BRANCH: ${{ github.ref_name }}

0 comments on commit cc80095

Please sign in to comment.