Add 'Co-authored-by' strings to the PR body based on the prior commits in the PR
(self)
| 399 | return body.strip() |
| 400 | |
| 401 | def body_with_co_authors(self) -> str: |
| 402 | """ |
| 403 | Add 'Co-authored-by' strings to the PR body based on the prior commits |
| 404 | in the PR |
| 405 | """ |
| 406 | body = self.processed_body() |
| 407 | author_lines = self.co_authors() |
| 408 | logging.info(f"Found co-authors: author_lines={author_lines}") |
| 409 | full_author_lines = [f"Co-authored-by: {author_line}" for author_line in author_lines] |
| 410 | |
| 411 | authors_to_add = [] |
| 412 | for author_line in author_lines: |
| 413 | if author_line not in body: |
| 414 | authors_to_add.append(f"Co-authored-by: {author_line}") |
| 415 | |
| 416 | if len(authors_to_add) > 0: |
| 417 | # If the line isn't already in the PR body (it could have been |
| 418 | # added manually), put it in |
| 419 | full_author_text = "\n".join(authors_to_add) |
| 420 | body = f"{body}\n\n{full_author_text}" |
| 421 | |
| 422 | return body |
| 423 | |
| 424 | def merge(self) -> None: |
| 425 | """ |
no test coverage detected