Skip to content

Commit 7e8072d

Browse files
authored
Merge pull request #503 from SCOREC/apw/ci-cache-cleanup
ci: remove all PR caches on close
2 parents 1049872 + b904e68 commit 7e8072d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.github/workflows/cleanup-caches.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ jobs:
1313
run: |
1414
echo "Fetching list of cache keys"
1515
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
16-
17-
## Setting this to not fail the workflow while deleting cache keys.
18-
set +e
19-
echo "Deleting caches..."
20-
for cacheKey in $cacheKeysForPR
21-
do
22-
gh cache delete $cacheKey
16+
while [ "$cacheKeysForPR" ]; do
17+
for cacheKey in $cacheKeysForPR; do
18+
echo gh cache delete $cacheKey
19+
gh cache delete $cacheKey
20+
done
21+
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
2322
done
24-
echo "Done"
2523
env:
2624
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2725
GH_REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)