Skip to content

Instantly share code, notes, and snippets.

@CAMOBAP
Created December 9, 2024 18:34
Show Gist options
  • Save CAMOBAP/c1c0811994b40c7b8a0fb1020997bdb8 to your computer and use it in GitHub Desktop.
Save CAMOBAP/c1c0811994b40c7b8a0fb1020997bdb8 to your computer and use it in GitHub Desktop.
GHA remove cache by regex
gh api -H "Accept: application/vnd.github+json" /repos/metanorma/metanorma-ietf/actions/caches \
| jq -r '.actions_caches[].key' | grep -E 'chocolatey-cache' \
| ruby -r 'cgi' -e 'while line = gets; puts CGI.escape(line.strip); end' \
| xargs -n 1 --no-run-if-empty -S 2048 -I {} \
env PAGER=cat gh api -X DELETE -H "Accept: application/vnd.github+json" "/repos/metanorma/metanorma-ietf/actions/caches?key={}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment