From 74f9e995cfd2fa11fecef720f03233054f2edced Mon Sep 17 00:00:00 2001
From: Peter Balogh
Date: Thu, 22 Oct 2026 16:39:25 +0200
Subject: [PATCH] ci: delete PR caches on close
Signed-off-by: Peter Balogh
---
.github/workflows/cleanup-pr-caches.yaml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 .github/workflows/cleanup-pr-caches.yaml
diff --git a/.github/workflows/cleanup-pr-caches.yaml b/.github/workflows/cleanup-pr-caches.yaml
new file mode 100644
index 0000000..955af4a
--- /dev/null
+++ b/.github/workflows/cleanup-pr-caches.yaml
@@ -0,0 +1,21 @@
+name: cleanup-pr-caches
+
+on:
+ pull_request:
+ types:
+ - closed
+
+jobs:
+ cleanup:
+ runs-on: ubuntu-latest
+ permissions:
+ actions: write
+ steps:
+ - name: Delete caches for the closed PR
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ PR_REF: refs/pull/${{ github.event.pull_request.number }}/merge
+ run: |
+ echo "Deleting all caches scoped to $PR_REF"
+ gh cache delete --all --ref "$PR_REF" --succeed-on-no-caches