File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ just respond with "123".
Original file line number Diff line number Diff line change 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`);
You can’t perform that action at this time.
0 commit comments