feat: increment nonce #106
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: cleanup caches by a branch | |
on: | |
pull_request: | |
types: | |
- closed | |
permissions: | |
actions: write | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cleanup | |
run: | | |
echo "Fetching list of cache keys for $BRANCH" | |
cacheInfo=$(gh cache list --ref $BRANCH --limit 100 --json key,id --jq '.[]|"\(.key)|\(.id)"') | |
if [ -z "$cacheInfo" ]; then | |
echo "No caches found for $BRANCH" | |
exit 0 | |
fi | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
while IFS='|' read -r key id || [ -n "$id" ]; do | |
echo "Deleting cache: $key (ID: $id)" | |
gh cache delete $id | |
done <<< "$cacheInfo" | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge |