Created
February 9, 2017 00:23
-
-
Save invisiblek/1b3dd8c0e34141ff8572bae3f88349dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python3 | |
targetBranches = ["cm-14.1", "cm-13.0", "cm-12.1", "cm-11.0"] | |
orgName = "LineageOS" | |
import os | |
import sys | |
from github import Github | |
e = os.environ.copy() | |
# Environment variables for github username and api token | |
u = e["GHUSER"] | |
p = e["GHTOKEN"] | |
org = Github(u, p).get_organization(orgName) | |
for repo in org.get_repos(): | |
repobranches = repo.get_branches() | |
repodefaultbranch = repo.default_branch | |
for tb in targetBranches: | |
if tb in repobranches: | |
if repodefaultbranch != tb: | |
print("Changing default branch from " + repodefaultbranch + " to " + tb + " for " + repo.name) | |
# repo.edit(name=repo.name, default_branch=targetBranch) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment