@@ -69,7 +69,7 @@ def __init__(self, args):
69
69
'url' : "https://api.github.com" ,
70
70
'git' : "https://github.com" ,
71
71
'repo' : self .args .github_repo ,
72
- 'token ' : self .args .github_token ,
72
+ 'auth ' : self .args .github_auth or None
73
73
}
74
74
if self .args .branches :
75
75
self .github ['branches' ] = self .args .branches .split (',' )
@@ -116,8 +116,8 @@ def get_parser():
116
116
required = True )
117
117
parser .add_argument ('--gitlab-repo' ,
118
118
help = 'Gitlab repo (for instance ceph/ceph)' )
119
- parser .add_argument ('--github-token ' ,
120
- help = 'GitHub authentication token' )
119
+ parser .add_argument ('--github-auth ' ,
120
+ help = 'GitHub auth credentials, in the form username: token' )
121
121
parser .add_argument ('--github-repo' ,
122
122
help = 'GitHub repo (for instance ceph/ceph)' ,
123
123
required = True )
@@ -197,9 +197,15 @@ def gitlab_create_remote(self, repo):
197
197
198
198
def git_mirror (self ):
199
199
name = self .gitlab ['name' ]
200
+ url = self .github ['git' ]
201
+
202
+ if (self .github ['auth' ]):
203
+ url = self .github ['git' ].replace ('https://' , 'https://{}@' .format (self .github ['auth' ]))
204
+
200
205
if not os .path .exists (name ):
201
- self .sh ("git clone --bare " + self . github [ 'git' ] +
206
+ self .sh ("git clone --bare " + url +
202
207
"/" + self .github ['repo' ] + " " + name )
208
+
203
209
repo = git .Repo (name )
204
210
os .chdir (name )
205
211
if not hasattr (repo .remotes , 'gitlab' ):
@@ -508,8 +514,8 @@ def get_pull_requests(self):
508
514
"https://developer.github.com/v3/pulls/#list-pull-requests"
509
515
g = self .github
510
516
query = {'state' : 'all' }
511
- if self . args . github_token :
512
- query ['access_token' ] = g ['token' ]
517
+ if g [ 'auth' ] :
518
+ query ['access_token' ] = g ['auth' ]. split ( ':' )[ 1 ]
513
519
514
520
def f (pull ):
515
521
if self .args .ignore_closed :
0 commit comments