@@ -3,6 +3,8 @@ name: Trigger AI Reviewer
33on :
44 issue_comment :
55 types : [created]
6+ pull_request :
7+ types : [review_requested]
68
79env :
810 IGNORED_BOTS : ' ["content-bot", "xsoar-bot", "dependabot"]'
@@ -15,37 +17,44 @@ jobs:
1517 contents : write
1618 pull-requests : read
1719 if : >-
18- github.event.issue.pull_request &&
19- (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') &&
20- !contains(fromJson(env.IGNORED_BOTS), github.event.comment.user.login) && contains(
21- fromJson(env.ALLOWED_COMMANDS), github.event.comment.body
22- )
20+ # Review request via PR commented command.
21+ (github.event_name == 'issue_comment' &&
22+ github.event.issue.pull_request &&
23+ (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') &&
24+ !contains(fromJson(env.IGNORED_BOTS), github.event.comment.user.login) &&
25+ contains(fromJson(env.ALLOWED_COMMANDS), github.event.comment.body)) ||
26+ # Review request via GH UI button
27+ (github.event_name == 'pull_request' &&
28+ github.event.requested_reviewer.login == 'content-bot')
2329 steps :
2430 - name : Checkout
2531 uses : actions/checkout@v4
2632 with :
2733 fetch-depth : 0
28-
29- - name : AI Reviewer Commands Detection
34+
35+ - name : Add Reaction
36+ if : github.event_name == 'issue_comment'
3037 env :
3138 GITHUB_TOKEN : ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
32- COMMENT_BODY : ${{ github.event.comment.body }}
3339 COMMENT_ID : ${{ github.event.comment.id }}
34- ISSUE_NUMBER : ${{ github.event.issue.number }}
3540 REPO : ${{ github.repository }}
3641 run : |
37-
38- # Add rocket reaction to mark review as in-progress
3942 echo "Adding 🚀 reaction..."
40- gh api "repos/$REPO/issues/comments/$COMMENT_ID/reactions" -f content="rocket" || {
41- echo "⚠️ Failed to add reaction. Proceeding anyway..."
42- }
43+ gh api "repos/$REPO/issues/comments/$COMMENT_ID/reactions" -f content="rocket" || true
44+
45+ - name : Trigger AI Review
46+ env :
47+ GITHUB_TOKEN : ${{ secrets.CONTENTBOT_GH_ADMIN_TOKEN }}
48+ COMMENT_ID : ${{ github.event.comment.id }}
49+ TRIGGER_TYPE : ${{ github.event_name }}
50+ run : |
51+ echo "🚀 Triggering AI Reviewer (via $TRIGGER_TYPE)..."
4352
44- # Trigger review by pushing an empty commit
45- echo "Triggering AI Reviewer..."
4653 git config --global user.email "bot@demisto.com"
4754 git config --global user.name "Content Bot"
55+
4856 git commit --allow-empty -m "Trigger AI Reviewer"
57+
4958 git push
5059
5160
0 commit comments