Skip to content

Instantly share code, notes, and snippets.

@crowne
Created October 27, 2025 14:14
Show Gist options
  • Save crowne/8d3e7cfec4b3b4063c6a979f0d53b3ee to your computer and use it in GitHub Desktop.
Save crowne/8d3e7cfec4b3b4063c6a979f0d53b3ee to your computer and use it in GitHub Desktop.
clear ghost notifications
# Dump all notifications to find the ids of scam notifs
gh api notifications > notifications.json
# Read and parse the JSON file
$notifications = Get-Content "notifications.json" | ConvertFrom-Json
# Find all objects with "unread": true and display their URLs
$notifications | Where-Object { $_.unread -eq $true } | ForEach-Object {
Write-Output $_.url
# Extract thread ID from URL (number after the last /)
$thread_id = $_.url -replace '.*/', ''
Write-Output "Deleting notification thread: $thread_id"
gh api -X DELETE "notifications/threads/$thread_id"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment