Skip to content

Instantly share code, notes, and snippets.

@tsl0922
Created October 9, 2022 16:14
Show Gist options
  • Save tsl0922/2042791664678437ab885d98b6291bdc to your computer and use it in GitHub Desktop.
Save tsl0922/2042791664678437ab885d98b6291bdc to your computer and use it in GitHub Desktop.
Clear github actions cache
REPO="OWNER/REPO"
TOKEN="TOKEN"
for id in $(curl -s \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${TOKEN}" \
https://api.github.com/repos/${REPO}/actions/caches | jq -r '.actions_caches[] | .id'); do
echo "Deleting cache with id: $id..."
curl -X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${TOKEN}" \
https://api.github.com/repos/${REPO}/actions/caches/${id}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment