From db49d34d906ab1bbe6efd68212cd87324fea3f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 19 May 2024 14:20:29 +0200 Subject: [PATCH] fuck_this_shit --- .github/workflows/cache_clean.yml | 24 ++++++++++++++++++++++++ .github/workflows/cache_clean_pr.yml | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/cache_clean.yml create mode 100644 .github/workflows/cache_clean_pr.yml diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml new file mode 100644 index 0000000000000..02a449cf26309 --- /dev/null +++ b/.github/workflows/cache_clean.yml @@ -0,0 +1,24 @@ +name: Clean cache after build + +on: + workflow_run: + workflows: [build] + types: [completed] + +jobs: + cache: + runs-on: ubuntu-latest + steps: + - run: | + echo $BRANCH + # gh extension install actions/gh-actions-cache + # set +e + # keys=$(gh actions-cache list -R ${{ github.repository }} -B $BRANCH | cut -f 1) + # set +e + # for key in $keys + # do + # gh actions-cache delete $key -R ${{ github.repository }} -B $BRANCH --confirm + # done + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ github.event.workflow_run.head_branch }} diff --git a/.github/workflows/cache_clean_pr.yml b/.github/workflows/cache_clean_pr.yml new file mode 100644 index 0000000000000..fcae0e149519a --- /dev/null +++ b/.github/workflows/cache_clean_pr.yml @@ -0,0 +1,22 @@ +name: Remove PR cache + +on: + pull_request_target: + types: closed + +jobs: + pr_cache: + runs-on: ubuntu-latest + steps: + - run: | + gh extension install actions/gh-actions-cache + set +e + keys=$(gh actions-cache list -R ${{ github.repository }} -B $BRANCH | cut -f 1) + set +e + for key in $keys + do + gh actions-cache delete $key -R ${{ github.repository }} -B $BRANCH --confirm + done + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge