claude-code-review.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Claude Code Review
  2. on:
  3. pull_request:
  4. types: [opened]
  5. # Optional: Only run on specific file changes
  6. # paths:
  7. # - "src/**/*.ts"
  8. # - "src/**/*.tsx"
  9. # - "src/**/*.js"
  10. # - "src/**/*.jsx"
  11. jobs:
  12. claude-review:
  13. # Optional: Filter by PR author
  14. # if: |
  15. # github.event.pull_request.user.login == 'external-contributor' ||
  16. # github.event.pull_request.user.login == 'new-developer' ||
  17. # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
  18. runs-on: ubuntu-latest
  19. permissions:
  20. contents: read
  21. pull-requests: read
  22. issues: read
  23. id-token: write
  24. steps:
  25. - name: Checkout repository
  26. uses: actions/checkout@v4
  27. with:
  28. fetch-depth: 1
  29. - name: Run Claude Code Review
  30. id: claude-review
  31. uses: anthropics/claude-code-action@v1
  32. with:
  33. anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
  34. prompt: |
  35. Please review this pull request and provide feedback on:
  36. - Code quality and best practices
  37. - Potential bugs or issues
  38. - Performance considerations
  39. - Security concerns
  40. - Test coverage
  41. - 以中文输出
  42. Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
  43. Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
  44. # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
  45. # or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
  46. claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'