| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py
|
| index c648dc0b1753ae45c5e6bf07283a9585e56174cb..411200c66895fe06c7c6a2e2417b20bed2815c55 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py
|
| @@ -24,7 +24,7 @@ class WPTGitHub(object):
|
| def auth_token(self):
|
| return base64.encodestring('{}:{}'.format(self.user, self.token))
|
|
|
| - def create_pr(self, local_branch_name, desc_title, body):
|
| + def create_pr(self, remote_branch_name, desc_title, body):
|
| """Creates a PR on GitHub.
|
|
|
| API doc: https://developer.github.com/v3/pulls/#create-a-pull-request
|
| @@ -32,12 +32,10 @@ class WPTGitHub(object):
|
| Returns:
|
| A raw response object if successful, None if not.
|
| """
|
| - assert local_branch_name
|
| + assert remote_branch_name
|
| assert desc_title
|
| assert body
|
|
|
| - pr_branch_name = '{}:{}'.format(self.user, local_branch_name)
|
| -
|
| # TODO(jeffcarp): CC foolip and qyearsley on all PRs for now
|
| # TODO(jeffcarp): add HTTP to Host and use that here
|
| conn = httplib2.Http()
|
| @@ -48,8 +46,9 @@ class WPTGitHub(object):
|
| body = {
|
| "title": desc_title,
|
| "body": body,
|
| - "head": pr_branch_name,
|
| + "head": remote_branch_name,
|
| "base": 'master',
|
| + # TODO(jeffcarp): it looks like this is not being added
|
| "labels": [EXPORT_LABEL]
|
| }
|
| resp, content = conn.request("https://api.github.com/repos/w3c/web-platform-tests/pulls",
|
| @@ -60,8 +59,7 @@ class WPTGitHub(object):
|
| return json.loads(content)
|
|
|
| def in_flight_pull_requests(self):
|
| - url_encoded_label = EXPORT_LABEL.replace(' ', '%20')
|
| - path = '/search/issues?q=repo:w3c/web-platform-tests%20is:open%20type:pr%20labels:{}'.format(url_encoded_label)
|
| + path = '/search/issues?q=repo:w3c/web-platform-tests%20is:open%20type:pr%20label:{}'.format(EXPORT_LABEL)
|
| response, content = self.request(path)
|
| if response['status'] == '200':
|
| data = json.loads(content)
|
| @@ -69,14 +67,13 @@ class WPTGitHub(object):
|
| else:
|
| raise Exception('Non-200 status code (%s): %s' % (response['status'], content))
|
|
|
| - def request(self, path, body=None):
|
| + def request(self, path, body=None, method='GET'):
|
| assert path.startswith('/')
|
|
|
| - # Not used yet since only hitting public API
|
| - # headers = {
|
| - # "Accept": "application/vnd.github.v3+json",
|
| - # "Authorization": "Basic " + self.auth_token()
|
| - # }
|
| + headers = {
|
| + "Accept": "application/vnd.github.v3+json",
|
| + "Authorization": "Basic " + self.auth_token()
|
| + }
|
|
|
| if body:
|
| json_body = json.dumps(body)
|
| @@ -84,12 +81,12 @@ class WPTGitHub(object):
|
| json_body = None
|
|
|
| conn = httplib2.Http()
|
| - return conn.request(API_BASE + path, body=json_body)
|
| + return conn.request(API_BASE + path, method, body=json_body, headers=headers)
|
|
|
| def merge_pull_request(self, pull_request_number):
|
| path = '/repos/w3c/web-platform-tests/pulls/%d/merge' % pull_request_number
|
| body = {}
|
| - response, content = self.request(path, body)
|
| + response, content = self.request(path, body=body, method='PUT')
|
|
|
| if response['status'] == '200':
|
| return json.loads(content)
|
|
|