Skip to content

chore: stricter typescript settings and some cleanup. #651

chore: stricter typescript settings and some cleanup.

chore: stricter typescript settings and some cleanup. #651

# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
name: Cleanup caches for closed branches
on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: 🧹 Cleanup caches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
# Install GitHub CLI cache extension
gh extension install actions/gh-actions-cache
echo "Fetching list of cache keys..."
cacheKeys=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1)
# Continue even if some cache deletions fail
set +e
if [ -z "$cacheKeys" ]; then
echo "No caches found to delete"
exit 0
fi
echo "Deleting caches..."
for cacheKey in $cacheKeys; do
echo "Deleting cache: $cacheKey"
gh actions-cache delete "$cacheKey" -R $REPO -B $BRANCH --confirm
done
echo "Cache cleanup completed"