Created
December 13, 2025 11:28
-
-
Save karimkod/65aa18976785f6d6bdeaca54c5b68d79 to your computer and use it in GitHub Desktop.
Bulk deleting github actions artifacts
This file contains hidden or 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
| $repos=$(gh api /user/repos?affiliation=owner,collaborator,organization_member --paginate) | |
| $repoNames=$($repos | jq -r '.[] | select(.permissions.admin == true or .permissions.push == true)) | |
| $artifacts=$($repoNames | %{ gh api /repos/$_/actions/artifacts --paginate}) | |
| $artifactUrls=$($artifacts | jq -r '.artifacts[].url' | %{ $_ -replace "https:\/\/api\.github\.com" }) | |
| $artifactUrls | %{ gh api -X DELETE $_ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment