Skip to content

Instantly share code, notes, and snippets.

@karimkod
Created December 13, 2025 11:28
Show Gist options
  • Select an option

  • Save karimkod/65aa18976785f6d6bdeaca54c5b68d79 to your computer and use it in GitHub Desktop.

Select an option

Save karimkod/65aa18976785f6d6bdeaca54c5b68d79 to your computer and use it in GitHub Desktop.
Bulk deleting github actions artifacts
$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