Created
November 11, 2025 22:13
-
-
Save D3SOX/7efe4b886f271e474a11655af765cf38 to your computer and use it in GitHub Desktop.
Since GitHub decided to remove that feature I created a script that watches all your repos https://github.blog/changelog/2025-05-22-sunset-of-automatic-watching-of-repositories-and-teams/
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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Extract the logged-in GitHub username | |
| USER=$(gh auth status 2>/dev/null | grep -oE 'account [^ ]+' | awk '{print $2}') | |
| if [ -z "${USER:-}" ]; then | |
| echo "β Could not detect logged-in GitHub username. Run 'gh auth login' first." | |
| exit 1 | |
| fi | |
| echo "π€ Logged in as $USER" | |
| echo "π Checking repositories..." | |
| # Loop through your repos and subscribe to all activity if not already watching | |
| gh repo list "$USER" --limit 1000 --json name,owner | jq -r '.[] | "\(.owner.login)/\(.name)"' | while read -r repo; do | |
| echo "Checking $repo..." | |
| sub=$(gh api "repos/$repo/subscription" --jq '.subscribed' 2>/dev/null || echo "false") | |
| if [ "$sub" != "true" ]; then | |
| echo "β‘ Subscribing to $repo" | |
| gh api --method PUT "repos/$repo/subscription" \ | |
| --input <(echo '{"subscribed": true, "ignored": false}') \ | |
| >/dev/null || echo "β Failed to subscribe to $repo" | |
| else | |
| echo "β Already watching $repo" | |
| fi | |
| done | |
| echo "π― Done! All your repositories are now set to 'Watching (All Activity)'." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment