tiimgreen / github-cheat-sheet

A list of cool features of Git and GitHub.
http://git.io/sheet
MIT License
47.37k stars 5.26k forks source link

I got unreaded notification about this repo but can't read it #234

Closed ameaninglessname closed 1 year ago

ameaninglessname commented 1 year ago

image

Technetium1 commented 1 year ago

Hey, this is a very unfortunate bug with GitHub that's still not patched. When a spam issue is created and removed, the spam notification remains. You have to create a token and do a request to get rid of it. Use a name you recognize for the token, and don't forget to delete when it's done. Here's what I've gotten from GitHub's staff in one of my past issues:


Hi there @Technetium1,

Thanks for writing in to Technical Support!

We are aware there can be an issue with "ghost" notifications in some situations, and are working towards a solution.

In the interim, the curl command below will mark all of your notifications as read, including those phantom messages.

A few things 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.

The Creating a Personal Access Token documentation 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 (today's 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":"2021-11-02T07:06: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.

ameaninglessname commented 1 year ago

Thanks!