Created
March 27, 2025 14:35
-
-
Save peetzweg/53a6f40c6bb2d2f0ae701514a4d3b6c4 to your computer and use it in GitHub Desktop.
Nuke GitHub Notifications - Mark All as Read
This file contains hidden or 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/bash | |
# Script to mark all GitHub notifications as read | |
# Requires GITHUB_TOKEN environment variable to be set | |
# Check if GITHUB_TOKEN is set | |
if [ -z "$GITHUB_TOKEN" ]; then | |
echo "Error: GITHUB_TOKEN environment variable is not set" | |
echo "Please set it with: export GITHUB_TOKEN=your_github_token" | |
exit 1 | |
fi | |
# Get current timestamp in ISO 8601 format | |
current_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
curl -L \ | |
-X PUT \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/notifications \ | |
-d "{\"last_read_at\":\"$current_time\",\"read\":true}" | |
echo "All GitHub notifications have been marked as read." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment