diff --git a/.github/workflows/clear-caches.yml b/.github/workflows/clear-caches.yml index 3c0783a3a8a..47e5ac48753 100644 --- a/.github/workflows/clear-caches.yml +++ b/.github/workflows/clear-caches.yml @@ -1,6 +1,9 @@ name: Clear cache on: + schedule: + # Run everyday at: https://crontab.guru/#0_6_*_*_*. + - cron: '0 6 * * *' workflow_dispatch: permissions: @@ -10,7 +13,7 @@ jobs: clear-cache: runs-on: ubuntu-latest steps: - - name: Clear cache + - name: Clear Firefox cache uses: actions/github-script@v7 with: script: | @@ -20,12 +23,13 @@ jobs: repo: context.repo.repo, }) for (const cache of caches.data.actions_caches) { - console.log(cache) - # Dry run - # github.rest.actions.deleteActionsCacheById({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # cache_id: cache.id, - # }) + if (cache.key.toLowerCase().startsWith('firefox')) { + console.log(cache) + github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }) + } } console.log("Clear completed")