应该是GitHub的一个逻辑漏洞,一些恶意仓库可以在项目中使用“at”提及到你,然后进行仓库项目删除。此时你就会得到一个无法消除的待阅读提醒,你点击消息提醒按钮但页面没有任何消息。
目前社区已经有很多人遭受到了这种垃圾提醒攻击,你可以叫他“幽灵消息”。
# 查询消息通知
gh api notifications
# 删除消息
gh api -X DELETE notifications/threads/$NOTIFICATION_ID
原始链接:https://github.com/orgs/community/discussions/174310#discussioncomment-14474599
OR 当然你也可以使用 curl 的请求方法
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/notifications \
-d '{"last_read_at": null,"read":true}'
具体参见:https://github.com/orgs/community/discussions/174310#discussioncomment-14475149
使用 gh 插件
如果你嫌一个一个删除太麻烦,已经有热心开发者做了一个插件来专门消除“幽灵消息”
gh extension install emmanuel-ferdman/gh-gonest
gh gonest
# 输出结果类似
[INFO] gh-gonest - GitHub Ghost Notification Cleaner
[INFO] Running as GitHub user: jeeinn
[INFO] Scanning for notifications...
[INFO] Found 1 total notifications
[INFO] Checking for phantom notifications...
[WARN] Found phantom: push-mail/gitcoin.com - Issue: Gitcoin Announcement | $15M Github Developer Fund
[INFO] Found 1 phantom notification(s)
[INFO] Cleaning phantom notifications...
[INFO] Cleaned: push-mail/gitcoin.com
[INFO] Cleanup complete!
[INFO] Summary: Successfully cleaned 1
[INFO] Execution completed successfully
原始链接:https://github.com/orgs/community/discussions/174283#discussioncomment-14529767