Skip to content

Commit d50e318

Browse files
committed
Merge remote-tracking branch 'origin/feature/ai-code-reviewers'
# Conflicts: # .github/workflows/pr_review_kimi.yaml
2 parents 1efc4d2 + 2d4867d commit d50e318

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

.github/workflows/pr_review_kimi.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: PR Review - Kimi
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened]
6+
pull_request_review_comment:
7+
types: [created]
8+
issue_comment:
9+
types: [created]
610

711
permissions:
812
contents: read
@@ -15,6 +19,10 @@ concurrency:
1519
jobs:
1620
kimi-review:
1721
name: Kimi Code Review
22+
if: |
23+
github.event_name == 'pull_request' ||
24+
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@kimi')) ||
25+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@kimi'))
1826
runs-on: ubuntu-latest
1927
steps:
2028
- name: Checkout repository
@@ -34,16 +42,26 @@ jobs:
3442
id: diff
3543
env:
3644
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
3746
run: |
38-
gh pr diff ${{ github.event.pull_request.number }} > pr_diff.txt
47+
gh pr diff $PR_NUMBER > pr_diff.txt
3948
# Truncate if too large (Kimi has context limits)
4049
head -c 100000 pr_diff.txt > pr_diff_truncated.txt
4150
51+
- name: Get PR title
52+
id: pr_info
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
56+
run: |
57+
TITLE=$(gh pr view $PR_NUMBER --json title -q '.title')
58+
echo "title=$TITLE" >> $GITHUB_OUTPUT
59+
4260
- name: Kimi Code Review
4361
id: kimi_review
4462
env:
4563
KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }}
46-
PR_TITLE: ${{ github.event.pull_request.title }}
64+
PR_TITLE: ${{ steps.pr_info.outputs.title }}
4765
REVIEW_PROMPT: ${{ steps.prompt.outputs.content }}
4866
run: |
4967
if [ -z "$KIMI_API_KEY" ]; then
@@ -99,15 +117,11 @@ jobs:
99117
- name: Post review comment
100118
env:
101119
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
102121
run: |
103-
gh pr comment ${{ github.event.pull_request.number }} --body-file kimi_review.txt --body-prefix "## Kimi AI Code Review
122+
gh pr comment $PR_NUMBER --body-file kimi_review.txt --body-prefix "## Kimi AI Code Review
104123
105124
" --body-suffix "
106125

107126
---
108127
*Automated review by Kimi (Moonshot AI)*"
109-
110-
$REVIEW_CONTENT
111-
112-
---
113-
*Automated review by Kimi (Moonshot AI)*"

0 commit comments

Comments
 (0)