deadman96385

Untitled

Jun 2nd, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. from github import Github
  2. import os
  3. GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
  4. ORG = os.environ['ORG']
  5. gh = Github(login_or_token=GITHUB_TOKEN)
  6. org = gh.get_organization(ORG)
  7. for repo in org.get_repos():
  8.     rate = gh.get_rate_limit().rate
  9.     print("Rate Limit: {}/{} remaining".format(rate.remaining, rate.limit))
  10.     print("Processing {}".format(repo.name))
  11.     DEFAULT_BRANCH = repo.default_branch
  12.     if DEFAULT_BRANCH != "android-5.1" and "android-5.1" in [x.name for x in repo.get_branches()]:
  13.         print("Migrating {} default branch to android-5.1".format(repo.name))
  14.         DEFAULT_BRANCH = "android-5.1"
  15.         repo.edit(has_wiki=False, has_issues=False, default_branch=DEFAULT_BRANCH)
  16.     else:
  17.         repo.edit(has_wiki=False, has_issues=False)
Advertisement
Add Comment
Please, Sign In to add comment