Skip to content

Commit

Permalink
Create cache.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
keylogic1 authored Jan 9, 2024
1 parent c998fee commit 8c56bba
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8c56bba

Please sign in to comment.