in sync/gh.py [0:0]
def create_pull(self,
title: str,
body: str,
base: str,
head: str,
_commits: Optional[List[AttrDict]] = None,
_id: Optional[int] = None,
_user: Optional[str] = None,
) -> int:
if _id is None:
id = next(self._id)
else:
id = int(_id)
assert id not in self.prs
if _user is None:
_user = env.config["web-platform-tests"]["github"]["user"]
if _commits is None:
_commits = [AttrDict(**{"sha": "%040x" % random.getrandbits(160),
"message": "Test commit",
"_statuses": [],
"_checks": []})]
data = AttrDict(**{
"number": id,
"title": title,
"body": body,
"base": {"ref": base},
"head": head,
"merged": False,
"merge_commit_sha": "%040x" % random.getrandbits(160),
"state": "open",
"mergeable": True,
"_approved": True,
"_commits": _commits,
"user": {
"login": _user
},
"labels": []
})
self.prs[id] = data
for commit in _commits:
self.commit_prs[commit["sha"]] = id
self._log("Created PR with id %s" % id)
return id