Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 24 additions & 36 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,45 @@
name: Claude Code Reviewa
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened, closed]

types: [opened, synchronize, ready_for_review, reopened]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
if: |
(github.event.pull_request.merged != true) && (
github.event.pull_request.author_association == 'MEMBER' ||
github.event.pull_request.author_association == 'OWNER' ||
github.event.pull_request.author_association == 'COLLABORATOR'
)
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
use_sticky_comment: 'true'
claude_args: |
--max-turns 20
--system-prompt "Você é um revisor sênior Python/Django. Revise em português. Foque em: segurança (OWASP), queries N+1, lógica de negócio e aderência ao CLAUDE.md do projeto."

- name: Gerar testes automaticamente
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Analise o diff deste PR: ${{ github.repository }}/pull/${{ github.event.pull_request.number }}.

Para cada função ou método novo que não possua testes correspondentes:
1. Crie testes pytest em português
2. Salve nos arquivos de teste existentes ou crie novos seguindo o padrão tests/test_*.py
3. Faça commit diretamente na branch do PR com a mensagem "test: testes gerados automaticamente pelo Claude"

Se todos os novos códigos já tiverem testes, não faça nada e comente no PR: "✅ Cobertura de testes OK"
claude_args: |
--max-turns 20
prompt: '/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options

Loading