From 8c56bba864e3c8867635e08c930734e864ee5a0c Mon Sep 17 00:00:00 2001 From: keylogic1 <119584546+keylogic1@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:14:02 +0200 Subject: [PATCH] Create cache.yml --- .github/workflows/cache.yml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/cache.yml diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml new file mode 100644 index 00000000..a8960135 --- /dev/null +++ b/.github/workflows/cache.yml @@ -0,0 +1,38 @@ +--- +# yamllint disable rule:line-length +name: Clear cache + +on: + schedule: + - cron: '30 1 * * 1-5' + workflow_dispatch: + +jobs: + job1: + name: Clear Docker + if: always() + runs-on: ${{ matrix.runner_label }} + strategy: + matrix: + runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6"]') }} + steps: + - name: Stop old containers + run: docker ps -q | grep -q . && docker stop $(docker ps -q) || echo "No containers to stop" + - name: Remove old containers + run: docker ps -a -q | grep -q . && docker rm $(docker ps -a -q) || echo "No containers to remove" + - name: Delete old images + run: docker system prune --volumes --all --force + job2: + name: Clear workspaces + if: always() + needs: job1 + runs-on: ${{ matrix.runner_label }} + strategy: + matrix: + runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6"]') }} + steps: + - uses: xembly/workflow-manager@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + run: clean + verbose: true