diff --git a/.github/workflows/purge-cache.yml b/.github/workflows/purge-cache.yml new file mode 100644 index 00000000000..b78c2cae160 --- /dev/null +++ b/.github/workflows/purge-cache.yml @@ -0,0 +1,63 @@ +name: Purge caches +on: + schedule: + # 4:10 UTC Sunday + - cron: "10 4 * * 0" + + workflow_dispatch: + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Purge Cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + + echo "Fetching list of cache key" + allCaches=$(gh actions-cache list -L 100 -R $REPO | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $allCaches + do + gh actions-cache delete $cacheKey -R $REPO --confirm + done + echo "Done" + + run-test-files: + name: Run test-files + needs: + - cleanup + uses: ./.github/workflows/test-files.yml + + run-test-linux: + name: Run test-linux + needs: + - cleanup + uses: ./.github/workflows/test-linux.yml + + run-test-mac: + name: Run test-mac + needs: + - cleanup + uses: ./.github/workflows/test-mac.yml + + run-test-remoteclient: + name: Run test-remoteclient + needs: + - cleanup + uses: ./.github/workflows/test-remoteclient.yml + + run-test-win: + name: Run test-win + needs: + - cleanup + uses: ./.github/workflows/test-win.yml diff --git a/.github/workflows/test-files.yml b/.github/workflows/test-files.yml index 7fb41afdccc..5e3bb9ce692 100644 --- a/.github/workflows/test-files.yml +++ b/.github/workflows/test-files.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,9 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' + + workflow_call: workflow_dispatch: diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 17fbf99e2c6..165d19f24ed 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,9 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' + + workflow_call: workflow_dispatch: inputs: diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml index ff283d444ed..4764baf9cd7 100644 --- a/.github/workflows/test-mac.yml +++ b/.github/workflows/test-mac.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,9 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' + + workflow_call: workflow_dispatch: inputs: diff --git a/.github/workflows/test-remoteclient.yml b/.github/workflows/test-remoteclient.yml index 9ea06d22643..8bf93755dda 100644 --- a/.github/workflows/test-remoteclient.yml +++ b/.github/workflows/test-remoteclient.yml @@ -15,6 +15,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -30,11 +31,14 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' + + workflow_call: workflow_dispatch: inputs: ssh: - # github_cli: gh workflow run test-linux.yml --ref -f ssh=true + # github_cli: gh workflow run test-remoteclient.yml --ref -f ssh=true description: 'Enable ssh debugging' required: false default: false diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index a6f74c8fb57..2a801c630f3 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,9 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' + + workflow_call: workflow_dispatch: inputs: