Last active
June 4, 2024 15:11
-
-
Save BartMassey/356ba118b561deb7168bca52c68836fe to your computer and use it in GitHub Desktop.
Mark all notifications as read ("Ghost notification" remover)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Mark all notifications as read, including "ghost" notifications. | |
# Works on Linux, requires a "classic" auth token be present in `~/.github-oauthtoken` | |
# and also that `gh` is installed. You could presumably use `gh auth login` instead | |
# if you want to authenticate that way. | |
# | |
# Works for me, use at your own risk. | |
# | |
# https://github.com/orgs/community/discussions/6874 | |
# https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#mark-notifications-as-read | |
GH_TOKEN="`cat $HOME/.github-oauthtoken`" gh api \ | |
--method PUT \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/notifications \ | |
-f last_read_at="`date -u +%Y-%m-%dT%H:%M:%SZ`" \ | |
-F read=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment