@@ -198,14 +198,17 @@ def update_deployment(self, target, deployment, state, description=''):
198
198
}, 'application/vnd.github.ant-man-preview+json' )
199
199
200
200
class 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 = '[email protected] :{}.git' .
format (
github_project )
203
206
204
207
def get_revision (self , refspec ):
205
208
output = subprocess .check_output ([
206
209
'git' ,
207
210
'ls-remote' ,
208
- self ._name ,
211
+ self ._url ,
209
212
'refs/{}' .format (refspec )
210
213
])
211
214
@@ -219,9 +222,7 @@ def delete_ref(self, refspec):
219
222
220
223
logger .info ('Deleting ref "%s"' , refspec )
221
224
222
- subprocess .check_call (
223
- ['git' , 'push' , self ._name , '--delete' , full_ref ]
224
- )
225
+ subprocess .check_call (['git' , 'push' , self ._url , '--delete' , full_ref ])
225
226
226
227
def is_open (pull_request ):
227
228
return not pull_request ['closed_at' ]
@@ -249,13 +250,13 @@ def is_deployed(host, deployment):
249
250
250
251
return response .text .strip () == deployment ['sha' ]
251
252
252
- def synchronize (host , github_project , remote_name , window ):
253
+ def synchronize (host , github_project , window ):
253
254
'''Inspect all pull requests which have been modified in a given window of
254
255
time. Add or remove the "preview" label and update or delete the relevant
255
256
git refs according to the status of each pull request.'''
256
257
257
258
project = Project (host , github_project )
258
- remote = Remote (remote_name )
259
+ remote = Remote (github_project )
259
260
260
261
pull_requests = project .get_pull_requests (
261
262
time .gmtime (time .time () - window )
@@ -355,7 +356,6 @@ def detect(host, github_project, target, timeout):
355
356
parser_sync = subparsers .add_parser (
356
357
'synchronize' , help = synchronize .__doc__
357
358
)
358
- parser_sync .add_argument ('--remote' , dest = 'remote_name' , required = True )
359
359
parser_sync .add_argument ('--window' , type = int , required = True )
360
360
parser_sync .set_defaults (func = synchronize )
361
361
0 commit comments