Skip to content

Commit 9dde0e2

Browse files
Add AI reviewer introduction comment to pull requests
1 parent d9cf987 commit 9dde0e2

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

.github/github_workflow_scripts/handle_external_pr.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
"to the contributions SLAs document."
4848
)
4949

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+
5058
XSOAR_SUPPORT_LEVEL_LABEL = "Xsoar Support Level"
5159
PARTNER_SUPPORT_LEVEL_LABEL = "Partner Support Level"
5260
COMMUNITY_SUPPORT_LEVEL_LABEL = "Community Support Level"
@@ -488,6 +496,21 @@ def replace_fixes_to_related_in_pr_body(pr: PullRequest) -> str:
488496
pr.edit(body=edited_body)
489497
return ""
490498

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+
491514

492515
def main():
493516
"""Handles External PRs (PRs from forks)
@@ -627,6 +650,9 @@ def main():
627650
if XSOAR_SUPPORT_LEVEL_LABEL or COMMUNITY_SUPPORT_LEVEL_LABEL in labels_to_add and ver != "1.0.0":
628651
pr.create_issue_comment(contributors_body)
629652

653+
post_ai_introduction(pr, reviewers, t)
630654

655+
656+
631657
if __name__ == "__main__":
632658
main()

.github/workflows/ai-review-introduction.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)