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": [{