Skip to content

Instantly share code, notes, and snippets.

@kbdharun
Created June 4, 2024 06:42
Show Gist options
  • Save kbdharun/c68748719c76705ca6080e0e9616ef91 to your computer and use it in GitHub Desktop.
Save kbdharun/c68748719c76705ca6080e0e9616ef91 to your computer and use it in GitHub Desktop.
Clearing Rogue GitHub notifications using GitHub CLI
  1. Have gh (GitHub CLI) installed locally and logged into your GitHub account (i.e. gh auth login).
  2. Execute the following command to clear rogue/frozen unread notifications:
gh api \
  --method PUT \
  -H "Accept: application/vnd.github+json" \
  /notifications \
  -f last_read_at="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
  -F read=true

If you don't have GNU's date command installed locally you can use:

gh api \
  --method PUT \
  -H "Accept: application/vnd.github+json" \
  /notifications \
  -f last_read_at='2022-06-10T00:00:00Z' \
  -F read=true

And voila, now you can go on your day peacefully with no unread notifications.

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