Skip to content

Commit f5054a2

Browse files
Remove unnecessary checkout step and narrow set +e scope in cache cleanup workflow
Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent 82625d5 commit f5054a2

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

.github/workflows/cleanup-caches.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ on:
77

88
permissions:
99
actions: write
10-
contents: read
1110

1211
jobs:
1312
cleanup:
1413
runs-on: ubuntu-latest
1514
steps:
16-
- name: Check out code
17-
uses: actions/checkout@v6
18-
1915
- name: Cleanup
2016
run: |
2117
gh extension install actions/gh-actions-cache
@@ -24,13 +20,14 @@ jobs:
2420
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
2521
echo "Fetching list of cache keys"
2622
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1)
27-
## Setting this to not fail the workflow while deleting cache keys.
28-
set +e
2923
echo "Deleting caches..."
24+
## Temporarily disable errexit so individual delete failures don't abort the loop.
25+
set +e
3026
for cacheKey in $cacheKeysForPR
3127
do
3228
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
3329
done
30+
set -e
3431
echo "Done"
3532
env:
3633
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)