Skip to content

CI: adopt tsgo and run Playwright perf nightly #95

CI: adopt tsgo and run Playwright perf nightly

CI: adopt tsgo and run Playwright perf nightly #95

name: Clean PR Caches
on:
pull_request:
types: [closed]
permissions: {}
jobs:
cleanup:
name: Clean PR Caches
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Delete caches for closed PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_REF: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
echo "Cleaning caches for $PR_REF"
CACHES=$(gh cache list --repo "$GITHUB_REPOSITORY" --ref "$PR_REF" --limit 100 --json id,key --jq '.[] | [.id, .key] | @tsv')
if [ -z "$CACHES" ]; then
echo "No caches found for $PR_REF"
exit 0
fi
while IFS=$'\t' read -r id key; do
echo "Deleting cache: $key ($id)"
gh cache delete "$id" --repo "$GITHUB_REPOSITORY"
done <<< "$CACHES"
echo "Done."