From 19dcd8e6cb0ce346055640403ef0076aa989facf Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Sat, 30 Dec 2023 16:09:03 +0000 Subject: [PATCH] simplified clear-cache github action --- .github/workflows/clear-cache.yml | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml index 773f92230..0e3dc2c0f 100644 --- a/.github/workflows/clear-cache.yml +++ b/.github/workflows/clear-cache.yml @@ -10,26 +10,10 @@ jobs: clear-cache: name: Clean Cache runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} steps: - name: Clear cache - uses: actions/github-script@v7 - with: - script: | - while (true) { - const caches = await github.rest.actions.getActionsCacheList({ - owner: context.repo.owner, - repo: context.repo.repo, - }) - if (caches.data.actions_caches.length === 0) { - break - } - for (const cache of caches.data.actions_caches) { - console.log('Deleting ' + cache.key) - github.rest.actions.deleteActionsCacheById({ - owner: context.repo.owner, - repo: context.repo.repo, - cache_id: cache.id, - }) - } - } - console.log("Clear cache completed") + run: | + gh cache delete --all --repo "$GITHUB_REPOSITORY" + echo "cache cleared"