Skip to content

Instantly share code, notes, and snippets.

@bleach
Last active January 29, 2019 10:55
Show Gist options
  • Save bleach/f17d404d2f5dbe86f77dbe51b4b8c111 to your computer and use it in GitHub Desktop.
Save bleach/f17d404d2f5dbe86f77dbe51b4b8c111 to your computer and use it in GitHub Desktop.
Check if LAA tech archs have access to all "laa repos"
#!/usr/bin/env python
import os
import requests
from github import Github
g = Github(os.environ['GITHUB_ACCESS_TOKEN']) # requires read:org and repo scopes
org = g.get_organization('ministryofjustice')
team = org.get_team(2369998) # laa-technical-architects
org_repos = org.get_repos()
laa_repos = [r for r in org_repos if r.name.startswith("laa")]
for r in laa_repos:
if not team.has_in_repos(r):
print r.html_url
team.add_to_repos(r)
team.set_repo_permission(r, 'admin')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment