@@ -198,14 +198,17 @@ def update_deployment(self, target, deployment, state, description=''):
198198 }, 'application/vnd.github.ant-man-preview+json' )
199199
200200class Remote (object ):
201- def __init__ (self , name ):
202- self ._name = name
201+ def __init__ (self , github_project ):
202+ # The repository in the GitHub Actions environment is configured with
203+ # a remote whose URL uses HTTPS, making it unsuitable for pushing
204+ # changes.
205+ self ._url = 'git@github.com:{}.git' .format (github_project )
203206
204207 def get_revision (self , refspec ):
205208 output = subprocess .check_output ([
206209 'git' ,
207210 'ls-remote' ,
208- self ._name ,
211+ self ._url ,
209212 'refs/{}' .format (refspec )
210213 ])
211214
@@ -219,9 +222,7 @@ def delete_ref(self, refspec):
219222
220223 logger .info ('Deleting ref "%s"' , refspec )
221224
222- subprocess .check_call (
223- ['git' , 'push' , self ._name , '--delete' , full_ref ]
224- )
225+ subprocess .check_call (['git' , 'push' , self ._url , '--delete' , full_ref ])
225226
226227def is_open (pull_request ):
227228 return not pull_request ['closed_at' ]
@@ -249,13 +250,13 @@ def is_deployed(host, deployment):
249250
250251 return response .text .strip () == deployment ['sha' ]
251252
252- def synchronize (host , github_project , remote_name , window ):
253+ def synchronize (host , github_project , window ):
253254 '''Inspect all pull requests which have been modified in a given window of
254255 time. Add or remove the "preview" label and update or delete the relevant
255256 git refs according to the status of each pull request.'''
256257
257258 project = Project (host , github_project )
258- remote = Remote (remote_name )
259+ remote = Remote (github_project )
259260
260261 pull_requests = project .get_pull_requests (
261262 time .gmtime (time .time () - window )
@@ -355,7 +356,6 @@ def detect(host, github_project, target, timeout):
355356 parser_sync = subparsers .add_parser (
356357 'synchronize' , help = synchronize .__doc__
357358 )
358- parser_sync .add_argument ('--remote' , dest = 'remote_name' , required = True )
359359 parser_sync .add_argument ('--window' , type = int , required = True )
360360 parser_sync .set_defaults (func = synchronize )
361361
0 commit comments