|
| 1 | +name: PR Check |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, ready_for_review, reopened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + # Fast validation - commits, build, tests |
| 9 | + validate: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v6 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: Setup Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version: '18' |
| 21 | + cache: 'npm' |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: npm ci |
| 25 | + |
| 26 | + - name: Validate Conventional Commits |
| 27 | + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |
| 28 | + |
| 29 | + - name: Build |
| 30 | + run: npm run build |
| 31 | + |
| 32 | + - name: Run Tests |
| 33 | + run: | |
| 34 | + if [ -f "package.json" ] && grep -q "\"test\":" "package.json"; then |
| 35 | + npm test |
| 36 | + else |
| 37 | + echo "No test script found in package.json" |
| 38 | + fi |
| 39 | +
|
| 40 | + # Claude Code review - runs after validation passes |
| 41 | + review: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: validate |
| 44 | + permissions: |
| 45 | + contents: read |
| 46 | + pull-requests: write |
| 47 | + id-token: write |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v6 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + |
| 54 | + - name: Claude Code Review |
| 55 | + uses: anthropics/claude-code-action@v1 |
| 56 | + with: |
| 57 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 58 | + track_progress: true |
| 59 | + |
| 60 | + prompt: | |
| 61 | + REPO: ${{ github.repository }} |
| 62 | + PR NUMBER: ${{ github.event.pull_request.number }} |
| 63 | +
|
| 64 | + Perform a comprehensive code review with the following focus areas: |
| 65 | +
|
| 66 | + ## 1. Release Workflow Compliance |
| 67 | +
|
| 68 | + This project uses Release Please with Conventional Commits. |
| 69 | +
|
| 70 | + **Version Bump Rules:** |
| 71 | + - `feat:` → Minor version bump (0.4.0 → 0.5.0) |
| 72 | + - `fix:`, `perf:`, `refactor:` → Patch version bump |
| 73 | + - `docs:`, `test:`, `ci:`, `build:`, `chore:`, `style:` → No version bump |
| 74 | +
|
| 75 | + Note: Commitlint already validated the commit format, so just verify |
| 76 | + the commits use appropriate types for the changes made. |
| 77 | +
|
| 78 | + ## 2. Code Quality |
| 79 | + - Clean code principles |
| 80 | + - Proper error handling |
| 81 | + - Code readability |
| 82 | +
|
| 83 | + ## 3. Security |
| 84 | + - Check for vulnerabilities |
| 85 | + - No secrets in code |
| 86 | +
|
| 87 | + ## 4. Testing |
| 88 | + - Adequate test coverage for new features |
| 89 | +
|
| 90 | + ## 5. Documentation |
| 91 | + - README updates for user-facing changes |
| 92 | +
|
| 93 | + Provide your review with specific feedback. |
0 commit comments