Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit bfcf7fd

Browse files
committed
Correct tag deletion logic
1 parent f0b3d25 commit bfcf7fd

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

.github/workflows/pull_request_previews.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
--host https://api.github.com
1616
--github-project web-platform-tests/wpt-actions-test
1717
synchronize
18-
--remote origin
1918
--window 480
2019
env:
2120
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

tools/ci/pr_preview.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,17 @@ def update_deployment(self, target, deployment, state, description=''):
198198
}, 'application/vnd.github.ant-man-preview+json')
199199

200200
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)
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

226227
def 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

Comments
 (0)