mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Fix the WPT export script
- Have the WPT exporter script use the WPT_SYNC_TOKEN for checking out wpt. - Make sure the local WPT repository is unshallow when pushing. - When searching for existing PRs use the main GitHub search API, as the pull request search does not seem to properly process the "head" parameter. - When deleting branches in the downstream WPT repository, use the full URL to avoid trying to modify the upstream repository.
This commit is contained in:
parent
aad3ad9102
commit
f4b5b9f85f
4 changed files with 58 additions and 14 deletions
|
@ -76,18 +76,30 @@ class GithubRepository:
|
|||
"""If this repository has an open pull request with the
|
||||
given source head reference targeting the master branch,
|
||||
return the first matching pull request, otherwise return None."""
|
||||
# Frustratingly, this is different from what you need for opening a pull request.
|
||||
head = f"{branch.repo.org}:{branch.name}"
|
||||
response = authenticated(
|
||||
self.sync, "GET", f"{self.pulls_url}?head={head}&base=master&state=open"
|
||||
)
|
||||
|
||||
params = "+".join([
|
||||
"is:pr",
|
||||
"state:open",
|
||||
f"repo:{self.repo}",
|
||||
f"author:{branch.repo.org}",
|
||||
f"head:{branch.name}",
|
||||
])
|
||||
response = authenticated(self.sync, "GET", f"search/issues?q={params}")
|
||||
if int(response.status_code / 100) != 2:
|
||||
return None
|
||||
|
||||
json = response.json()
|
||||
if not json or not isinstance(json, list):
|
||||
if not isinstance(json, dict) or \
|
||||
"total_count" not in json or \
|
||||
"items" not in json:
|
||||
raise ValueError(
|
||||
f"Got unexpected response from GitHub search: {response.text}"
|
||||
)
|
||||
|
||||
if json["total_count"] < 1:
|
||||
return None
|
||||
return self.get_pull_request(json[0]["number"])
|
||||
|
||||
return self.get_pull_request(json["items"][0]["number"])
|
||||
|
||||
def open_pull_request(self, branch: GithubBranch, title: str, body: str):
|
||||
data = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue