PyO3: Update wheel workflow #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clean branch caches | |
on: | |
pull_request: | |
types: | |
- closed | |
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries | |
jobs: | |
clean-caches: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clean caches | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge | |
run: | | |
echo "Fetching cache keys for: $BRANCH" | |
cache_keys_for_pr=$(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 cache_key in $cache_keys_for_pr; do | |
echo "Deleting cache key: $cache_key" | |
gh cache delete "$cache_key" | |
done | |
echo "Done" |