Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from github import Github
- import os
- GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
- ORG = os.environ['ORG']
- gh = Github(login_or_token=GITHUB_TOKEN)
- org = gh.get_organization(ORG)
- for repo in org.get_repos():
- rate = gh.get_rate_limit().rate
- print("Rate Limit: {}/{} remaining".format(rate.remaining, rate.limit))
- print("Processing {}".format(repo.name))
- DEFAULT_BRANCH = repo.default_branch
- if DEFAULT_BRANCH != "android-5.1" and "android-5.1" in [x.name for x in repo.get_branches()]:
- print("Migrating {} default branch to android-5.1".format(repo.name))
- DEFAULT_BRANCH = "android-5.1"
- repo.edit(has_wiki=False, has_issues=False, default_branch=DEFAULT_BRANCH)
- else:
- repo.edit(has_wiki=False, has_issues=False)
Advertisement
Add Comment
Please, Sign In to add comment