Created
December 11, 2025 16:53
-
-
Save Drowze/b0323754b666c4196b306a86be82b54d to your computer and use it in GitHub Desktop.
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
| # Unsubscribe from all repositories of a given organization, | |
| # except from thoses where you're a contributor | |
| set org myorg | |
| set username johndoe | |
| for repo in (gh api /orgs/$org/repos --paginate | jq -r '.[] | select(.archived == false).name') | |
| if gh api /repos/$org/$repo/contributors | jq >/dev/null -e --arg username "$username" 'map(.login) | index($username)' | |
| gh api -XPUT /repos/$org/$repo/subscription -F "subscribed=true" -F "ignored=false" | jq -c | |
| else | |
| gh api -XDELETE /repos/$org/$repo/subscription | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment