From 3e80e2d850d22d325a1d3b1a87161d7bd188d5ea Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Mon, 18 Nov 2024 21:39:54 -0800 Subject: [PATCH] gc --- .github/workflows/delete_pr_cache.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/delete_pr_cache.yaml diff --git a/.github/workflows/delete_pr_cache.yaml b/.github/workflows/delete_pr_cache.yaml new file mode 100644 index 0000000000..db5ccbd40b --- /dev/null +++ b/.github/workflows/delete_pr_cache.yaml @@ -0,0 +1,22 @@ +name: cache deleter +on: + pull_request_target: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Cleanup + run: | + keys=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') + set +e + for key in $keys + do + gh cache delete $key + done + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge