Skip to content

Instantly share code, notes, and snippets.

@BartMassey
Last active October 18, 2025 12:54
Show Gist options
  • Select an option

  • Save BartMassey/356ba118b561deb7168bca52c68836fe to your computer and use it in GitHub Desktop.

Select an option

Save BartMassey/356ba118b561deb7168bca52c68836fe to your computer and use it in GitHub Desktop.
Mark all notifications as read ("Ghost notification" remover)
#!/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
@ali0une

ali0une commented Oct 18, 2025

Copy link
Copy Markdown

thanks worked great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment