File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77jobs :
88 review :
9- name : Gemini Code Review
9+ name : Claude Code Review
1010 runs-on : ubuntu-latest
1111 # Skip if the PR was opened by the bot itself
1212 if : github.actor != 'github-actions[bot]'
Original file line number Diff line number Diff line change @@ -3,8 +3,15 @@ import { Octokit } from "@octokit/rest";
33
44const prNumber = parseInt ( process . env . PR_NUMBER ) ;
55const githubToken = process . env . GITHUB_TOKEN ;
6- const [ repoOwner , repoName ] = ( process . env . GITHUB_REPOSITORY || "" ) . split ( "/" ) ;
6+ const repo = process . env . GITHUB_REPOSITORY || "" ;
7+ const [ repoOwner , repoName ] = repo . split ( "/" ) ;
78
9+ if ( ! prNumber || ! githubToken || ! repoOwner || ! repoName || ! process . env . ANTHROPIC_API_KEY ) {
10+ console . error ( "Missing required environment variables." ) ;
11+ process . exit ( 1 ) ;
12+ }
13+
14+ const MAX_DIFF_CHARS = 20000 ;
815const octokit = new Octokit ( { auth : githubToken } ) ;
916
1017async function runReview ( ) {
@@ -22,6 +29,10 @@ async function runReview() {
2229 return ;
2330 }
2431
32+ const truncatedDiff = prDiff . length > MAX_DIFF_CHARS
33+ ? prDiff . slice ( 0 , MAX_DIFF_CHARS ) + "\n\n... [diff truncated]"
34+ : prDiff ;
35+
2536 const prompt = `You are a senior Python engineer reviewing a pull request for the Node9 Python SDK.
2637Node9 is an execution security library — a @protect decorator that intercepts AI agent tool calls and asks for human approval before running them.
2738
@@ -37,7 +48,7 @@ Do NOT rewrite the code. Just review it.
3748Keep your review under 400 words.
3849
3950## Git Diff:
40- ${ prDiff } `;
51+ ${ truncatedDiff } `;
4152
4253 console . log ( "Sending diff to Claude for review..." ) ;
4354 const client = new Anthropic ( { apiKey : process . env . ANTHROPIC_API_KEY } ) ;
You can’t perform that action at this time.
0 commit comments