Skip to content

Instantly share code, notes, and snippets.

@FluxCapacitor2
Created February 4, 2023 02:55
Show Gist options
  • Save FluxCapacitor2/09c7a3ce5c9875b495ea06304b82c0dd to your computer and use it in GitHub Desktop.
Save FluxCapacitor2/09c7a3ce5c9875b495ea06304b82c0dd to your computer and use it in GitHub Desktop.
Remove all GitHub Actions caches for a repository
#!/bin/bash
# Requires the "gh" CLI
# https://cli.github.com/
# Install the GitHub Actions cache extension for the GitHub CLI
gh extension install actions/gh-actions-cache
# Purge the 100 oldest cache entries
# (running the script multiple times may cause a rate limit to be hit; this can be solved by waiting a few minutes)
gh actions-cache list -L 100 --sort last-used --order asc | awk '{print $1}' | xargs -d\\n -n1 gh actions-cache delete --confirm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment