Last active
January 29, 2019 10:55
-
-
Save bleach/f17d404d2f5dbe86f77dbe51b4b8c111 to your computer and use it in GitHub Desktop.
Check if LAA tech archs have access to all "laa repos"
This file contains 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 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