diff --git a/.github/workflows/misc-remove_cache.yaml b/.github/workflows/misc-remove_cache.yaml new file mode 100644 index 00000000..43876896 --- /dev/null +++ b/.github/workflows/misc-remove_cache.yaml @@ -0,0 +1,20 @@ +name: Misc - Remove cache + +on: + workflow_dispatch: + workflow_run: + workflows: + - Application - Test + types: + - completed + +jobs: + misc-remove_cache: + runs-on: ubuntu-latest + + steps: + # remove cache older than 1 hour ago + - run: + for ID in $(gh cache list --json id,createdAt | jq ".[].createdAt |= (sub(\"\\\\..*Z\";\"Z\") | fromdateiso8601 < `expr $(date +%s) - 60 \* 60`)" | jq -r '.[].id'); + do gh cache delete $ID; + done