Skip to content

Instantly share code, notes, and snippets.

@Tyrrrz
Created June 22, 2023 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tyrrrz/7bf335f3a6b41ba0deabb42a9bef7e3c to your computer and use it in GitHub Desktop.
Save Tyrrrz/7bf335f3a6b41ba0deabb42a9bef7e3c to your computer and use it in GitHub Desktop.
GitHub CLI script to delete all issues by a user
gh auth login --web
$repo = "" # set repo here
$author = "" # set author here
$issues = gh issue list --repo $repo --author $author --limit 1000 --json number,author,title | ConvertFrom-Json
foreach ($issue in $issues) {
$issueNumber = $issue.number
$issueAuthor = $issue.author.login
$issueTitle = $issue.title
Write-Host "Deleting issue: #$issueNumber $issueTitle (by $issueAuthor)..."
Read-Host -Prompt "Press ENTER to confirm..."
gh issue delete $issueNumber --yes | Out-Null
}
Write-Host "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment