From d0139f52931940efba1b6bb7d9eebba62050da96 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 12 Oct 2023 13:14:43 +0300 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=9A=A7=20clear=20cache=20once=20a?= =?UTF-8?q?=20month=20and=20manual=20run=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- .github/workflows/clear-cache.yml | 33 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/clear-cache.yml diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml new file mode 100644 index 00000000..76aed5cf --- /dev/null +++ b/.github/workflows/clear-cache.yml @@ -0,0 +1,33 @@ + +name: Clear cache + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: + +permissions: + actions: write + +jobs: + clear-cache: + runs-on: ubuntu-latest + steps: + - name: Clear cache + uses: actions/github-script@v6 + with: + script: | + console.log("About to clear") + const caches = await github.rest.actions.getActionsCacheList({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + for (const cache of caches.data.actions_caches) { + console.log(cache) + github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }) + } + console.log("Clear completed") diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89caaf5a..cd151b02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,8 @@ jobs: uses: actions/checkout@v3 - name: 🐍 Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 + # id based on python version + id: python-setup with: python-version: ${{ matrix.python-version }} check-latest: true