|
47 | 47 | "to the contributions SLAs document." |
48 | 48 | ) |
49 | 49 |
|
| 50 | +AI_REVIEWER_INTRODUCTION_MSG = ( |
| 51 | + "## 🤖 AI-Powered Code Review Available\n\n" |
| 52 | + "Hi @{reviewers}, you can leverage AI-powered code review to assist with this PR!\n\n" |
| 53 | + "**Available Commands:**\n" |
| 54 | + "- `@content_bot start review` - Initiate a full AI code review\n" |
| 55 | + "- `@content_bot re-review` - Incremental review for new commits\n" |
| 56 | +) |
| 57 | + |
50 | 58 | XSOAR_SUPPORT_LEVEL_LABEL = "Xsoar Support Level" |
51 | 59 | PARTNER_SUPPORT_LEVEL_LABEL = "Partner Support Level" |
52 | 60 | COMMUNITY_SUPPORT_LEVEL_LABEL = "Community Support Level" |
@@ -488,6 +496,21 @@ def replace_fixes_to_related_in_pr_body(pr: PullRequest) -> str: |
488 | 496 | pr.edit(body=edited_body) |
489 | 497 | return "" |
490 | 498 |
|
| 499 | +def post_ai_introduction(pr: PullRequest, reviewers: list[str], t: Terminal) -> None: |
| 500 | + """ |
| 501 | + Posts the AI reviewer introduction comment. |
| 502 | +
|
| 503 | + Args: |
| 504 | + pr (PullRequest): The PullRequest object. |
| 505 | + reviewers (list[str]): List of assigned reviewers. |
| 506 | + t (Terminal): The terminal object for printing. |
| 507 | + """ |
| 508 | + reviewer_mentions = ", ".join([f"@{r}" for r in reviewers]) |
| 509 | + ai_introduction_body = AI_REVIEWER_INTRODUCTION_MSG.format(reviewers=reviewer_mentions) |
| 510 | + pr.create_issue_comment(ai_introduction_body) |
| 511 | + print(f"{t.cyan}Posted AI reviewer introduction comment{t.normal}") |
| 512 | + |
| 513 | + |
491 | 514 |
|
492 | 515 | def main(): |
493 | 516 | """Handles External PRs (PRs from forks) |
@@ -627,6 +650,9 @@ def main(): |
627 | 650 | if XSOAR_SUPPORT_LEVEL_LABEL or COMMUNITY_SUPPORT_LEVEL_LABEL in labels_to_add and ver != "1.0.0": |
628 | 651 | pr.create_issue_comment(contributors_body) |
629 | 652 |
|
| 653 | + post_ai_introduction(pr, reviewers, t) |
630 | 654 |
|
| 655 | + |
| 656 | + |
631 | 657 | if __name__ == "__main__": |
632 | 658 | main() |
0 commit comments