Request a merge of this PR via the GitHub API
(self)
| 422 | return body |
| 423 | |
| 424 | def merge(self) -> None: |
| 425 | """ |
| 426 | Request a merge of this PR via the GitHub API |
| 427 | """ |
| 428 | url = f"pulls/{self.number}/merge" |
| 429 | |
| 430 | title = self.raw["title"] + f" (#{self.number})" |
| 431 | body = self.body_with_co_authors() |
| 432 | logging.info(f"Full commit:\n{title}\n\n{body}") |
| 433 | |
| 434 | data = { |
| 435 | "commit_title": title, |
| 436 | "commit_message": body, |
| 437 | # The SHA is necessary in case there was an update right when this |
| 438 | # script ran, GitHub will sort out who won |
| 439 | "sha": self.head_oid(), |
| 440 | "merge_method": "squash", |
| 441 | } |
| 442 | if self.dry_run: |
| 443 | logging.info(f"Dry run, would have merged with url={url} and data={to_json_str(data)}") |
| 444 | return |
| 445 | |
| 446 | r = self.github.put(url, data=data) |
| 447 | logging.info(f"GitHub merge response: {r}") |
| 448 | return r |
| 449 | |
| 450 | def author(self) -> str: |
| 451 | return self.raw["author"]["login"] |
no test coverage detected