Files
openfe/.github/workflows/clean_cache.yaml
Mike Henry 728a6810b3 Create Pooch Cache (#1647)
* Create Pooch Cache

* not exactly sure where the cache will be on osx

* print some debug info

* update cache clearing action

* Debug osx location now

* allow errors when deugging

* lets see what is in the cache

* see if the cache actually works

* since the cache is in 2 different locations, we need to include the OS in the key

* test cache

* it works!!!
2025-11-03 08:12:08 -08:00

32 lines
943 B
YAML

# from https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#force-deleting-cache-entries
name: Cleanup github runner caches on closed pull requests
on:
workflow_dispatch:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup
run: |
echo "Fetching list of cache keys"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge