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..a35a22b7c3b3050758496034990c8a2d4d65578d 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_github.py |
@@ -36,7 +36,7 @@ class WPTGitHub(object): |
assert desc_title |
assert body |
- pr_branch_name = '{}:{}'.format(self.user, local_branch_name) |
+ pr_branch_name = local_branch_name |
qyearsley
2016/12/02 00:38:46
Why not just rename the argument to pr_branch_name
jeffcarp
2016/12/02 23:55:17
Oops, left that in there from deleting some other
|
# TODO(jeffcarp): CC foolip and qyearsley on all PRs for now |
# TODO(jeffcarp): add HTTP to Host and use that here |
@@ -50,6 +50,7 @@ class WPTGitHub(object): |
"body": body, |
"head": pr_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", |
@@ -61,7 +62,7 @@ class WPTGitHub(object): |
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(url_encoded_label) |
qyearsley
2016/12/02 00:38:46
For URL-encoding query strings, you can also use u
jeffcarp
2016/12/02 23:55:17
Sounds good. At the moment the label we're using i
|
response, content = self.request(path) |
if response['status'] == '200': |
data = json.loads(content) |
@@ -69,14 +70,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 +84,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) |