From ebf0da1d7dc818ae569711caf948bede2082a3b8 Mon Sep 17 00:00:00 2001 From: Enrico Minack Date: Mon, 4 Nov 2024 17:28:02 +0100 Subject: [PATCH] Add manual workflow to clear all caches --- .github/workflows/clear-caches.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/clear-caches.yaml diff --git a/.github/workflows/clear-caches.yaml b/.github/workflows/clear-caches.yaml new file mode 100644 index 00000000..c2c54cbc --- /dev/null +++ b/.github/workflows/clear-caches.yaml @@ -0,0 +1,29 @@ +name: Clear caches + +on: + workflow_dispatch: + +permissions: + actions: write + +jobs: + clear-cache: + runs-on: ubuntu-latest + steps: + - name: Clear caches + uses: actions/github-script@v7 + with: + script: | + const caches = await github.rest.actions.getActionsCacheList({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + for (const cache of caches.data.actions_caches) { + console.log(cache) + github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }) + } +