diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-08-29 11:26:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-29 09:26:04 +0000 |
commit | 65c2e75379a4c79ff815267c23353fa5898325c7 (patch) | |
tree | 9c44668bb3fcde4d3c6eed0a676e7db9cbf166d9 /python | |
parent | 89421b70ada45d32ba0d5cfb0e921b5f459bf74f (diff) | |
download | servo-65c2e75379a4c79ff815267c23353fa5898325c7.tar.gz servo-65c2e75379a4c79ff815267c23353fa5898325c7.zip |
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>
Diffstat (limited to 'python')
-rw-r--r-- | python/wpt/exporter/__init__.py | 2 | ||||
-rw-r--r-- | python/wpt/exporter/github.py | 6 | ||||
-rw-r--r-- | python/wpt/test.py | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/python/wpt/exporter/__init__.py b/python/wpt/exporter/__init__.py index b2df5675598..b89f1fa2b99 100644 --- a/python/wpt/exporter/__init__.py +++ b/python/wpt/exporter/__init__.py @@ -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( diff --git a/python/wpt/exporter/github.py b/python/wpt/exporter/github.py index 824bcb997f4..c46f9d86700 100644 --- a/python/wpt/exporter/github.py +++ b/python/wpt/exporter/github.py @@ -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}") diff --git a/python/wpt/test.py b/python/wpt/test.py index e6231f8d0a0..adf48a0d7c2 100644 --- a/python/wpt/test.py +++ b/python/wpt/test.py @@ -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": [{ |