|
| 1 | +name: Claude Code Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | + # Optional: Only run on specific file changes |
| 7 | + paths: |
| 8 | + - 'src/**/*.ts' |
| 9 | + - 'src/**/*.tsx' |
| 10 | + - 'src/**/*.js' |
| 11 | + - 'src/**/*.jsx' |
| 12 | + - 'package.json' |
| 13 | + - 'package-lock.json' |
| 14 | + |
| 15 | +jobs: |
| 16 | + claude-review: |
| 17 | + # Optional: Skip review for specific conditions |
| 18 | + if: | |
| 19 | + !contains(github.event.pull_request.title, '[skip-review]') && |
| 20 | + !contains(github.event.pull_request.title, '[WIP]') |
| 21 | +
|
| 22 | + runs-on: ubuntu-latest |
| 23 | + permissions: |
| 24 | + contents: read |
| 25 | + pull-requests: read |
| 26 | + issues: read |
| 27 | + id-token: write |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + |
| 35 | + - name: Run Claude Code Review |
| 36 | + id: claude-review |
| 37 | + uses: anthropics/claude-code-action@beta |
| 38 | + with: |
| 39 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 40 | + |
| 41 | + # Specify model for consistency with main workflow |
| 42 | + model: 'claude-opus-4-20250514' |
| 43 | + |
| 44 | + # Direct prompt for automated review (no @claude mention needed) |
| 45 | + direct_prompt: | |
| 46 | + Review this YDB Embedded UI pull request focusing on: |
| 47 | +
|
| 48 | + 1. **Code Standards**: |
| 49 | + - TypeScript type safety and proper interface usage (prefixed with 'T') |
| 50 | + - React best practices and Gravity UI component usage |
| 51 | + - Redux Toolkit patterns with RTK Query |
| 52 | + - BEM naming convention with cn() utility |
| 53 | +
|
| 54 | + 2. **Critical Requirements**: |
| 55 | + - All user-facing text must use i18n (no hardcoded strings) |
| 56 | + - API calls must go through window.api, never direct calls |
| 57 | + - No state mutations in RTK Query |
| 58 | + - Route params validation (React Router v5) |
| 59 | +
|
| 60 | + 3. **Performance & Security**: |
| 61 | + - Virtual scrolling for large tables (PaginatedTable) |
| 62 | + - React.memo for expensive renders |
| 63 | + - No exposed secrets or keys |
| 64 | + - Proper error handling and loading states |
| 65 | +
|
| 66 | + 4. **Testing**: |
| 67 | + - Unit tests in __test__ directories |
| 68 | + - E2E tests follow page object pattern |
| 69 | +
|
| 70 | + Be constructive and reference specific files with file_path:line_number format. |
| 71 | +
|
| 72 | + # Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR |
| 73 | + use_sticky_comment: true |
| 74 | + |
| 75 | + # Optional: Customize review based on file types |
| 76 | + # direct_prompt: | |
| 77 | + # Review this PR focusing on: |
| 78 | + # - For TypeScript files: Type safety and proper interface usage |
| 79 | + # - For API endpoints: Security, input validation, and error handling |
| 80 | + # - For React components: Performance, accessibility, and best practices |
| 81 | + # - For tests: Coverage, edge cases, and test quality |
| 82 | + |
| 83 | + # Optional: Different prompts for different authors |
| 84 | + # direct_prompt: | |
| 85 | + # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && |
| 86 | + # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || |
| 87 | + # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} |
| 88 | + |
| 89 | + # Add specific tools for running tests or linting |
| 90 | + allowed_tools: | |
| 91 | + Bash(npm run lint) |
| 92 | + Bash(npm run typecheck) |
| 93 | + Bash(npm test -- --no-watch) |
| 94 | + Bash(npm run unused) |
| 95 | + Bash(git diff) |
| 96 | + Bash(git log) |
| 97 | +
|
| 98 | + # Optional: Skip review for certain conditions |
| 99 | + # if: | |
| 100 | + # !contains(github.event.pull_request.title, '[skip-review]') && |
| 101 | + # !contains(github.event.pull_request.title, '[WIP]') |
0 commit comments