Skip to content

build(deps): bump kjanat/actionlint from 1.14.0 to 1.16.1 #78

build(deps): bump kjanat/actionlint from 1.14.0 to 1.16.1

build(deps): bump kjanat/actionlint from 1.14.0 to 1.16.1 #78

Workflow file for this run

name: Cleanup github runner caches on closed pull requests
on:
pull_request_target:
types:
- closed
delete:
jobs:
cleanup:
runs-on: ubuntu-slim
permissions:
actions: write
steps:
- name: Cleanup
if: github.event.ref_type == 'branch' || github.event.action == 'closed'
run: |
echo "Fetching list of cache keys"
readarray -t cacheKeysForPR < <(gh cache list --limit 100 --ref "${REF}" --json id --jq '.[].id')
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
set +x
for cacheKey in "${cacheKeysForPR[@]}"
do
gh cache delete "${cacheKey}"
done
set -x
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
REF: |
${{ case(
github.event.ref_type == 'branch', github.event.ref,
github.event.action == 'closed', format('refs/pull/{0}/merge', github.event.pull_request.number),
'ERROR') }}