GitHub notification cannot clear bug

GitHub notification cannot clear bug

A few days ago I received a new type of spam email. Basically they create a GitHub repo and then spam everyone they want in the issues by @ them. Of course this gets banned after being reported. I do not do anything because I think someone else will do the reporting work.

Days later, when I log in to GitHub, I notice that there is a dot in the notification box, which means that there are unread notifications. So I tried to mark all notifications as read. The problem is that the spam notifications refuse to be deleted. Why is that? After checking I found that the spam repo has been deleted, maybe by GitHub. I tried everything in the Wed UI but failed.

I am not busy that day, so I decided to create a ticket in GitHub support, which is

Days ago I received a spam email subjected as Re: [kl-heisenberg/AI-hiring] Initial commit (a1a534d).

Somebody use this method to send ad emails. I just ignored it.

Today when I go to my notification box https://github.com/notifications?query=is%3Aunread

There is an annoying item shows this repo, but without any content (you deleted this user).

In the end, I can not clear the notification box.

See this image of my notification box: https://imgur.com/a/qRgBDcq

You can see the screenshot at https://imgur.com/a/qRgBDcq.

3 days later I got the solution. Why so long? Github claims they are busy lol. Maybe Microsoft needs to do something right :)

The solution worked like a charm, I attach it below.

Note: following paragraphs are from GitHub Support.

Thank you for reaching out to GitHub Support. Apologies for the late response and I am sorry you are having trouble with your inbox notifications. ​ We have had a few reports of this bug and our engineers are looking into it. I’ve informed our engineers regarding your report as well. It’s very useful for us to have more data points, so thank you for submitting this to us!

In the meantime, you can try the curl command below, it will mark all of your notifications as read, clear the notification indicator, and with any luck, take care of that phantom notification for you.​ Note that the 1-0 of 1 message may still persist after the curl command is run; our engineers are looking into this as well.

A few things I’d like to note:

  • In order to use this command a Personal Access Token (PAT) will be required and $TOKEN needs to be replaced by a personal access token you can create here: https://github.com/settings/tokens/new. Creating a Personal Access Token also has the steps to create a token. After it is created, replace $TOKEN in the command with your new PAT.
  • Note: Please ensure that the PAT has the notifications scope.
  • Please update the date and time to your current date and note the time values must be in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
curl -H "Authorization: bearer $TOKEN" -X PUT -H "Accept: application/vnd.github.v3+json" https://api.github.com/notifications -d '{"last_read_at":"2023-01-25T19:42:00"}'

You can also export the current date and time in bash by running:

export now=$(date +%Y-%m-%dT%H:%M:%SZ)

Then you can use the date and time variable in the curl command as follows:

curl -H "Authorization: bearer $TOKEN" -X PUT -H "Accept: application/vnd.github.v3+json" https://api.github.com/notifications -d '{"last_read_at":"'"$now"'"}'

For your reference, here is the documentation for the Notifications REST API endpoint.