ci: Fix the WPT export job after the repository change (#33228)

The GitHub search API is a bit sensitive. There isn't a great way to
search for the repository organization and the branch name when looking
for open PRs. Instead use the bot username as the author name, which
should likely have been having before. This fixes the WPT export job.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-08-29 11:26:04 +02:00 committed by GitHub
parent 89421b70ad
commit 65c2e75379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View file

@ -180,7 +180,7 @@ class WPTSync:
wpt_branch_name_from_servo_pr_number(servo_pr.number)
)
upstream_pr = self.wpt.get_open_pull_request_for_branch(
downstream_wpt_branch
self.github_username, downstream_wpt_branch
)
if upstream_pr:
logging.info(

View file

@ -72,7 +72,9 @@ class GithubRepository:
return GithubBranch(self, name)
def get_open_pull_request_for_branch(
self, branch: GithubBranch
self,
github_username: str,
branch: GithubBranch
) -> Optional[PullRequest]:
"""If this repository has an open pull request with the
given source head reference targeting the main branch,
@ -82,7 +84,7 @@ class GithubRepository:
"is:pr",
"state:open",
f"repo:{self.repo}",
f"author:{branch.repo.org}",
f"author:{github_username}",
f"head:{branch.name}",
])
response = authenticated(self.sync, "GET", f"search/issues?q={params}")

View file

@ -140,12 +140,11 @@ class MockGitHubAPIServer():
assert params["is"] == "pr"
assert params["state"] == "open"
assert "author" in params
assert "head" in params
head_ref = f"{params['author']}:{params['head']}"
head_ref = f":{params['head']}"
for pull_request in self.pulls:
if pull_request.head == head_ref:
if pull_request.head.endswith(head_ref):
return json.dumps({
"total_count": 1,
"items": [{