GitHub: Advanced Example¶
Production-ready configuration with all best practices.
Step 1: Add a Secret¶
Settings โ Secrets and variables โ Actions โ New repository secret
| Name | Value |
|---|---|
AI_REVIEWER_GOOGLE_API_KEY |
Your Gemini API key |
Step 2: Create the File¶
.github/workflows/ai-review.yml:
name: AI Code Review
on:
pull_request:
types: [opened, synchronize, reopened]
# Optional: file filter
# paths:
# - '**.py'
# - '**.js'
# - '**.ts'
# Cancel previous run on new commit
concurrency:
group: ai-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
review:
name: AI Review
runs-on: ubuntu-latest
# Don't run for fork PRs (secrets not available)
if: github.event.pull_request.head.repo.full_name == github.repository
# Don't block PR if review fails
continue-on-error: true
# Timeout protection
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- name: Run AI Code Review
uses: KonstZiv/ai-code-reviewer@v1
with:
google_api_key: ${{ secrets.AI_REVIEWER_GOOGLE_API_KEY }}
language: uk
language_mode: adaptive
log_level: INFO
What's Included¶
| Feature | Status | Description |
|---|---|---|
| Inline comments | With Apply Suggestion | |
| Concurrency | Cancels old runs | |
| Fork filter | Skips fork PRs | |
| Timeout | 10 minutes max | |
| Non-blocking | PR not blocked | |
| Custom language | language: uk |
Variations¶
With File Filter¶
With Branch Filter¶
With Custom Model¶
- uses: KonstZiv/ai-code-reviewer@v1
with:
google_api_key: ${{ secrets.AI_REVIEWER_GOOGLE_API_KEY }}
gemini_model: gemini-1.5-pro # More powerful model
With DEBUG Logs¶
- uses: KonstZiv/ai-code-reviewer@v1
with:
google_api_key: ${{ secrets.AI_REVIEWER_GOOGLE_API_KEY }}
log_level: DEBUG
Action Options¶
| Input | Description | Default |
|---|---|---|
google_api_key |
Gemini API key | required |
github_token |
GitHub token | ${{ github.token }} |
language |
Response language | en |
language_mode |
adaptive / fixed |
adaptive |
gemini_model |
Gemini model | gemini-2.5-flash |
log_level |
Log level | INFO |
Troubleshooting¶
Review Not Appearing¶
- Check workflow logs
- Check that it's not a fork PR
- Check
permissions: pull-requests: write
Rate Limit¶
Concurrency automatically cancels old runs, reducing load.