Removing invisible unread GitHub notifications

Some months ago I noticed that even after I marked all my GitHub notifications as read, the unread icon displayed at the right top corner was still showing as if I had unread notifications.

GitHub Notifications icon always-on mode
GitHub Notifications icon always-on mode

I tried changing the filters, waiting for a new notification to appear so that I could mark it as read, all hoping that icon would then change. But no matter what I tried in the GitHub UI, the icon was still there.

Then I opened a ticket with GitHub support and within a couple of days they replied suggesting me to use their REST API to mark notifications as read. So if you have the same issue, try the following code:

curl -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token $TOKEN_GOES_HERE" \ -d '{"last_read_at": "'$(date '+%Y-%m-%dT%H:%M:%SZ')'"}'

You will have to create a token and use it in the command above. Just give it “Notifications” permission, and delete it after you have used it.

Categories: blog

Tags: opensource