|
| 1 | +name: Claude PR Code Review |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, ready_for_review, reopened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + code-review: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: read |
| 12 | + pull-requests: write |
| 13 | + id-token: write |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v5 |
| 18 | + with: |
| 19 | + fetch-depth: 1 |
| 20 | + |
| 21 | + - name: Comprehensive PR Review |
| 22 | + uses: anthropics/claude-code-action@v1 |
| 23 | + with: |
| 24 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 25 | + track_progress: true |
| 26 | + prompt: | |
| 27 | + REPO: ${{ github.repository }} |
| 28 | + PR NUMBER: ${{ github.event.pull_request.number }} |
| 29 | +
|
| 30 | + Perform a comprehensive code review for WordPress Studio, focusing on: |
| 31 | +
|
| 32 | + 1. **Cross-Platform Compatibility (macOS & Windows)** |
| 33 | + - Path separators: Use `path.join()` or `path.resolve()` instead of hardcoded `/` or `\` |
| 34 | + - File system differences: Case sensitivity, path length limits, reserved filenames |
| 35 | + - Platform-specific APIs: Check `process.platform` usage and platform guards |
| 36 | + - Environment variables: HOME vs USERPROFILE, temp directories |
| 37 | + - Line endings: Ensure .gitattributes handles CRLF/LF correctly |
| 38 | + - Electron platform code: Verify macOS and Windows-specific implementations work correctly |
| 39 | + - Testing: Flag code that needs testing on both platforms |
| 40 | +
|
| 41 | + 2. **Code Quality** |
| 42 | + - Clean code principles and TypeScript best practices |
| 43 | + - Proper error handling and edge cases |
| 44 | + - Code readability and maintainability |
| 45 | + - Following patterns in docs/ai-instructions.md |
| 46 | +
|
| 47 | + 3. **Security (OWASP Top 10)** |
| 48 | + - SQL injection, XSS, authentication/authorization flaws |
| 49 | + - Sensitive data exposure, hardcoded secrets |
| 50 | + - Input validation and sanitization |
| 51 | + - Electron-specific: Node integration disabled, context isolation, IPC validation, CSP |
| 52 | + - External content handling security |
| 53 | +
|
| 54 | + 4. **Performance** |
| 55 | + - Identify potential bottlenecks |
| 56 | + - Database query efficiency |
| 57 | + - Memory leaks or resource issues |
| 58 | + - Bundle size impact for Electron app |
| 59 | +
|
| 60 | + 5. **Testing** |
| 61 | + - Adequate test coverage (Jest unit tests) |
| 62 | + - Test quality and edge cases |
| 63 | + - Missing test scenarios |
| 64 | + - E2E test considerations (Playwright) |
| 65 | +
|
| 66 | + 6. **Documentation** |
| 67 | + - Code properly documented |
| 68 | + - docs/ai-instructions.md updates for new features or architectural changes |
| 69 | + - API documentation accuracy |
| 70 | + - README updates if needed |
| 71 | +
|
| 72 | + Provide detailed feedback using inline comments for specific issues. |
| 73 | + Use top-level comments for general observations or praise. |
| 74 | + Be thorough but constructive in your feedback. |
| 75 | +
|
| 76 | + claude_args: | |
| 77 | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" |
0 commit comments