Skip to content

Instantly share code, notes, and snippets.

@Drowze
Created December 11, 2025 16:53
Show Gist options
  • Select an option

  • Save Drowze/b0323754b666c4196b306a86be82b54d to your computer and use it in GitHub Desktop.

Select an option

Save Drowze/b0323754b666c4196b306a86be82b54d to your computer and use it in GitHub Desktop.
# 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