Automated code review in 20 minutes
This GitHub Action reviews every pull request with Claude AI. It catches security vulnerabilities, performance issues, and code smell β before any human reviewer sees the code. Cost: ~$0.01 per PR on Izzi API.
Step 1: Create the GitHub Action
# .github/workflows/ai-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get diff
id: diff
run: |
DIFF=$(git diff origin/main...HEAD -- '*.ts' '*.tsx' '*.py' '*.js')
echo "diff<<EOF" >> $GITHUB_OUTPUT
echo "$DIFF" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: AI Review
uses: actions/github-script@v7
env:
IZZI_API_KEY: ${{ secrets.IZZI_API_KEY }}
with:
script: |
const diff = `${{ steps.diff.outputs.diff }}`;
if (!diff.trim()) return;
const response = await fetch('https://api.izziapi.com/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.IZZI_API_KEY}`,
},
body: JSON.stringify({
model: 'claude-sonnet-4-20250514',
messages: [{
role: 'user',
content: `Review this PR diff. Focus on:
1. Security vulnerabilities (critical)
2. Bugs and logic errors (high)
3. Performance issues (medium)
4. Code style improvements (low)
Format: bullet list with severity and file:line.
${diff.substring(0, 15000)}`
}],
max_tokens: 2000,
}),
});
const data = await response.json();
const review = data.choices[0].message.content;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.name,
issue_number: context.issue.number,
body: `## π€ AI Code Review\n\n${review}\n\n---\n*Powered by Izzi API + Claude Sonnet 4*`,
});Step 2: Add your API key to GitHub Secrets
- Go to your repo β Settings β Secrets and variables β Actions
- Click "New repository secret"
- Name:
IZZI_API_KEY - Value:
izzi-YOUR_KEY_HERE
Cost analysis
| PRs per month | Avg diff size | Cost (Izzi API) |
|---|---|---|
| 50 | 500 lines | $0.63 |
| 200 | 500 lines | $2.52 |
| 500 | 500 lines | $6.30 |
