Skip to content

Commit

Permalink
ci(fix): update cleanup_caches.yml to use new cache management comman…
Browse files Browse the repository at this point in the history
…ds and fix permissions

#4297
  • Loading branch information
JakobLichterfeld committed Oct 29, 2024
1 parent 54cf47a commit d6793ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/cleanup_caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
permissions:
contents: read
packages: read
actions: write

jobs:
check_paths:
Expand All @@ -30,17 +31,15 @@ jobs:
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
cacheKeysForPR=$(gh cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
gh cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
Expand Down

0 comments on commit d6793ce

Please sign in to comment.