Skip to content

chore(deps): update dependency prettier to v3.4.1 #280

chore(deps): update dependency prettier to v3.4.1

chore(deps): update dependency prettier to v3.4.1 #280

Workflow file for this run

name: Cleanup caches
on:
pull_request:
types:
- closed
workflow_dispatch:
inputs:
branchName:
description: 'Branch Name (leave empty to delete all caches)'
required: false
default: ''
deleteAll:
description: 'Set to true to delete all caches (ignores Branch Name)'
required: false
default: 'false'
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cleanup Caches
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
DELETE_ALL="${{ github.event.inputs.deleteAll }}"
MANUAL_BRANCH="${{ github.event.inputs.branchName }}"
if [ "$DELETE_ALL" == "true" ]; then
echo "Deleting all caches..."
allCacheKeys=$(gh actions-cache list -R $REPO | cut -f 1)
for cacheKey in $allCacheKeys
do
gh actions-cache delete $cacheKey -R $REPO --confirm
done
else
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
if [ -n "$MANUAL_BRANCH" ]; then
BRANCH="refs/heads/$MANUAL_BRANCH"
fi
fi
echo "Fetching list of cache keys for branch: $BRANCH"
cacheKeysForBranch=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches for branch: $BRANCH"
for cacheKey in $cacheKeysForBranch
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
fi
echo "Done"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}