From 72d6b8705418e1aaae217f3baeb3a679cfc2f80a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:29:44 +0000 Subject: [PATCH 1/3] Initial plan From 82625d5619013c1f2a599254e3b7e2e908dcf1d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:39:45 +0000 Subject: [PATCH 2/3] Add workflow to clean up PR-specific caches on pull request close Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .github/workflows/cleanup-caches.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/cleanup-caches.yml diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml new file mode 100644 index 000000000..071f4349f --- /dev/null +++ b/.github/workflows/cleanup-caches.yml @@ -0,0 +1,36 @@ +name: Cleanup Caches by Branch + +on: + pull_request: + types: + - closed + +permissions: + actions: write + contents: read + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" + echo "Fetching list of cache keys" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1) + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f5054a2bdbbccfa2225a0bc3e4ed09a78bd037d8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 21:33:42 +0000 Subject: [PATCH 3/3] Remove unnecessary checkout step and narrow set +e scope in cache cleanup workflow Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .github/workflows/cleanup-caches.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml index 071f4349f..2f52e9278 100644 --- a/.github/workflows/cleanup-caches.yml +++ b/.github/workflows/cleanup-caches.yml @@ -7,15 +7,11 @@ on: permissions: actions: write - contents: read jobs: cleanup: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v6 - - name: Cleanup run: | gh extension install actions/gh-actions-cache @@ -24,13 +20,14 @@ jobs: BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" echo "Fetching list of cache keys" cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1) - ## Setting this to not fail the workflow while deleting cache keys. - set +e echo "Deleting caches..." + ## Temporarily disable errexit so individual delete failures don't abort the loop. + set +e for cacheKey in $cacheKeysForPR do gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm done + set -e echo "Done" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}