Sage – Revisão de Código com IA em GitHub Actions
nssalian/sage
Revisão automática de código em PRs com IA multi-provider
Ver no GitHubGitHub Action que automatiza revisão de código usando Claude (Anthropic), GPT (OpenAI) ou Gemini (Vertex AI). Analisa PRs e posta comentários inline com problemas encontrados, categorizados por severidade. Suporta guidelines customizados e controle de custos via limites de tokens.
Instalação
npx convez-ai nssalian/sage1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Automação de code review em equipes
- Detecção de vulnerabilidades (SQL injection, XSS) antes do merge
- Garantia de padrões de código em repositórios
- Redução de sobrecarga manual de revisão
Veredito

Ferramenta madura e bem configurada para CI/CD. Suporta três provedores LLM principais com defaults sensatos e opções avançadas (thinking budget, guidelines customizadas). Ideal para equipes que querem automatizar revisão sem perder qualidade — requer atenção aos custos de tokens em repositórios grandes.
README
A tradução para o português deste README ainda está na fila.
Sage
AI code review for GitHub Actions. Uses Anthropic Claude, OpenAI GPT, or Google Gemini (Vertex AI).
Quick Start
Add .github/workflows/sage.yml:
name: Sage Review
on:
pull_request:
types: [labeled]
issue_comment:
types: [created]
permissions:
contents: read
pull-requests: write
jobs:
review:
if: |
(github.event_name == 'pull_request' && github.event.label.name == 'sage') ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '/sage'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nssalian/sage@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
llm-provider: anthropic
llm-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
Trigger a review by adding the sage label or commenting /sage on a PR.
Secrets and Auth
Store secrets in repo settings -> Secrets -> Actions:
ANTHROPIC_API_KEYfor Anthropic ClaudeOPENAI_API_KEYfor OpenAI GPT
Google Gemini uses Vertex AI (not the public Gemini API):
- Set
llm-provider: google - Set
google-project-idinput - Authenticate via Workload Identity or a service account with
GOOGLE_APPLICATION_CREDENTIALS llm-api-keyis still required by the action input validation, but is not used by Vertex AI. Set it to any dummy value with 10+ characters using onlya-zA-Z0-9_-:.(for exampleDUMMY_LLM_KEY).
Configuration
- uses: nssalian/sage@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
llm-provider: anthropic # anthropic, openai, or google
llm-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
# Optional settings
llm-model: "" # Defaults: claude-sonnet-4-5-20250929, gpt-4-turbo-preview, gemini-1.5-pro
google-project-id: "" # Required when llm-provider: google
google-location: us-central1 # Vertex AI location
max-files: 50 # Limit files reviewed (cost control)
max-lines: 2000 # Limit total lines changed
max-tokens: 50000 # Max tokens per review
thinking-budget: 10000 # Anthropic only
guidelines-path: SAGE.md # Project-specific guidelines
severity-threshold: LOW # CRITICAL, HIGH, MEDIUM, LOW
fail-on-errors: false # Fail workflow if the LLM call errors
Custom Guidelines
Create SAGE.md in your repo root to add project-specific review guidelines:
# Review Guidelines
Focus on:
- SQL injection and XSS vulnerabilities
- Async/await error handling
- Never log API keys or tokens
Supported Providers
Defaults are set in action.yaml and can be overridden via llm-model:
- Anthropic Claude:
claude-sonnet-4-5-20250929 - OpenAI GPT:
gpt-4-turbo-preview - Google Gemini (Vertex AI):
gemini-1.5-pro
How It Works
- Triggered by label (
sage) or comment (/sage) - Analyzes changed files in the PR
- Posts inline comments for each issue found
- Posts a summary comment with severity breakdown
- Updates the same comment on re-review
- Prints token usage and estimated cost in the workflow output
Issues are categorized as CRITICAL, HIGH, MEDIUM, or LOW based on impact.
Local Testing
export LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY=your-key
export GITHUB_TOKEN=your-token
./test-local.sh owner/repo 123 /tmp/repo
For Google (Vertex AI):
export LLM_PROVIDER=google
export GOOGLE_PROJECT_ID=your-project-id
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
export GOOGLE_API_KEY=DUMMY_LLM_KEY
export GITHUB_TOKEN=your-token
./test-local.sh owner/repo 123 /tmp/repo
Set DRY_RUN=false to actually post comments.
Development
make install # Install dependencies
make lint # Run linter
make test # Run tests
License
Apache 2.0 - see LICENSE