# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Cache Cleanup
on:
pull_request:
types:
permissions:
jobs:
cleanup:
name: Clean PR Caches
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete caches for closed PR
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
gh cache list --ref "refs/pull/${PR_NUMBER}/merge" --limit 100 --json id --jq '.[].id' | xargs -r -n 1 gh cache delete