From 1ed21d10db3f57e19861a865722d039238e82c8b Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 11 Sep 2023 20:05:17 +0800 Subject: [PATCH] Clear caches older than 5 days (#8494) --- .github/workflows/cleanup-cache.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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