Use oauth token to create GitHub project if available
Make sure you have repo/public_repo and write:org scopes.
Change-Id: I773331d2b0051865d783af5024fac1490c64c782
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index f125975..721078e 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -276,9 +276,11 @@
secure_config = ConfigParser.ConfigParser()
secure_config.read(github_secure_config)
- # Project creation doesn't work via oauth
- ghub = github.Github(secure_config.get("github", "username"),
- secure_config.get("github", "password"))
+ if secure_config.has_option("github", "oauth_token"):
+ ghub = github.Github(secure_config.get("github", "oauth_token"))
+ else:
+ ghub = github.Github(secure_config.get("github", "username"),
+ secure_config.get("github", "password"))
orgs = ghub.get_user().get_orgs()
orgs_dict = dict(zip([o.login.lower() for o in orgs], orgs))