Skip to content

Commit a7c405f

Browse files
committed
w
1 parent 1309b17 commit a7c405f

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.github/PROMPTS/review.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
just respond with "123".

.github/workflows/claude.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Claude Auto Review
2+
3+
on:
4+
pull_request
5+
6+
jobs:
7+
auto-review:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Generate review with Claude
18+
id: code-review
19+
uses: anthropics/claude-code-base-action@beta
20+
with:
21+
prompt_file: ".github/PROMPTS/review.txt"
22+
allowed_tools: "View,GlobTool,GrepTool,Bash" # keep it simple
23+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
24+
25+
- name: Extract and Comment PR Review
26+
if: steps.code-review.outputs.conclusion == 'success'
27+
uses: actions/github-script@v7
28+
with:
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
script: |
31+
const fs = require('fs');
32+
const executionFile = '${{ steps.code-review.outputs.execution_file }}';
33+
const executionLog = JSON.parse(fs.readFileSync(executionFile, 'utf8'));
34+
35+
const review = executionLog[executionLog.length - 1].result;
36+
37+
const res = await github.rest.pulls.createReview({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
pull_number: context.issue.number,
41+
event: 'COMMENT', // or 'APPROVE' / 'REQUEST_CHANGES'
42+
body: review
43+
});
44+
45+
core.info(`✅ Review #${res.data.id} posted`);

0 commit comments

Comments
 (0)