diff --git a/.github/workflows/cleanup-cache.yml b/.github/workflows/cleanup-cache.yml index a3c4d25a4..cf03bbfee 100644 --- a/.github/workflows/cleanup-cache.yml +++ b/.github/workflows/cleanup-cache.yml @@ -1,19 +1,28 @@ name: Cleanup cache on: + schedule: + - cron: "0 11 * * *" pull_request: types: - closed -# Workflow copied from https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries jobs: cleanup: runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v3 - - - name: Cleanup + + - name: Cleanup caches older than 5 days + if: github.event_name == 'schedule' + uses: MyAlbum/purge-cache@v2 + with: + max-age: 432000 + + # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries + - name: Cleanup on PR close + if: github.event_name == 'pull_request' run: | gh extension install actions/gh-actions-cache