Remove Spam Notification on GitHub
What happened
I got a GitHub notification that I couldn't see nor remove. The repository name was plasma-network/plasma.to. At first, I thought one of my coworkers created a new repository. But it wasn't. I tried to open the repository, but I couldn't.
So I googled for a few days.
I found this discussion on GitHub's community forum where others were experiencing the similar issue.
So it was spam. 👾
The problem
The notification badge appeared in my GitHub interface, but clicking on it didn't reveal the actual notification. The repository name remained visible in my notifications page, but I couldn't access or remove it through the web interface. This was frustrating because the badge kept showing up, and I couldn't get rid of it.
The solution
I followed the solution from the GitHub community discussion. The contributors there explained that GitHub's CLI (gh) provides the tools needed to manage notifications programmatically. Here's how I followed their solution step by step:
1. Remove the notification badge
First, I marked all notifications as read to remove the blue badge:
gh api /notifications -X PUT -f read=true
This removed the blue badge 🔵 from the interface.
But the repository name still remained in repositories section.
2. Check the notification list
To see all my notifications, I ran:
gh api --paginate 'notifications?all=true&per_page=100' | jq -r '.[].repository.full_name' | sort -u
Then I got:
command not found: jq
...🫠
3. Install jq
I needed jq to parse the JSON output. jq is a lightweight command-line JSON processor.
Visit https://jqlang.org/ for more information.
On macOS, I installed it with:
brew install jq
4. Check the notification list again
After installing jq, I ran the same command again:
gh api --paginate 'notifications?all=true&per_page=100' | jq -r '.[].repository.full_name' | sort -u
Now I got a list of repositories:
...
plasma-network/plasma.to
yoniakabecky/my-personal-repository
Yay! 🙌 I could see the spam repository in the list.
5. Get the notification ID
To delete the specific notification, I needed its ID. I filtered for the spam repository:
gh api --paginate 'notifications?all=true&per_page=100' | jq -r '.[] | select(.repository.full_name == "plasma-network/plasma.to") | "\(.id) - \(.subject.title) - unread: \(.unread)"'
The output showed:
19200066437 - Plasma Foundation | Over USD 2.4B TVL & 54.02% APY, XPL and Staking Rewards - unread: false
I had the notification ID: 19200066437.
6. Delete the notification
Finally, I deleted the notification thread:
gh api --method DELETE "notifications/threads/19200066437"
The spam notification was gone! 🎉
Conclusion
If you encounter a persistent GitHub notification that you can't remove through the web interface, use GitHub CLI. The combination of gh api and jq gives you full control over your notifications, even when the web interface fails.
The key commands to remember:
Mark all as read:
gh api /notifications -X PUT -f read=trueList all notifications:
gh api --paginate 'notifications?all=true&per_page=100' | jq -r '.[].repository.full_name' | sort -uDelete a specific notification:
gh api --method DELETE "notifications/threads/{THREAD_ID}"


