Skip to content

Preserve entry positions in cache, bump when adding new ones #55

Preserve entry positions in cache, bump when adding new ones

Preserve entry positions in cache, bump when adding new ones #55

name: Claude Code Review
on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"
jobs:
claude-review:
# 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: read
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
You are reviewing PR #${{ github.event.pull_request.number }} in the repository ${{ github.repository }}.
Review this pull request and provide feedback focused only on improvements needed (not what works well):
**Categories to check:**
1. Code quality and best practices
2. Potential bugs or issues
3. Performance considerations
4. Security concerns
5. Backwards compatibility
**Process:**
- The PR number is: ${{ github.event.pull_request.number }}
- View the PR using: `gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }}`
- Read CLAUDE.md to understand best practices
- View the PR diff using: `gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }}`
- If an issue spans multiple categories, list it only once in the most relevant section
- Prioritize by severity: 🔴 Critical → 🟡 Major → 🔵 Minor
- Focus only on changes introduced in this PR, not pre-existing code issues
- Test coverage is currently not a priority
**Review Workflow (Follow these steps):**
1. **Analysis Phase**: Review the PR diff and identify potential issues
2. **Validation Phase**: For each issue you find, verify it by:
- Re-reading the relevant code carefully
- Checking if your suggested fix is actually different from the current code
- Confirming the issue violates documented standards (check CLAUDE.md)
- Ensuring your criticism is actionable and specific
3. **Draft Phase**: Write your review only after validating all issues
4. **Quality Check**: Before posting, remove any issues where:
- Your "before" and "after" code snippets are identical
- You're uncertain or use phrases like "appears", "might", "should verify"
- The issue is theoretical without clear impact
5. **Post Phase**: Only post the review if you have concrete, validated feedback
**Edge Case Policy:**
Only flag edge cases that meet ALL of these criteria:
1. Realistic: Could happen in normal usage or common error scenarios
2. Impactful: Would cause bugs, security issues, or data problems (not just "it's not perfect")
3. Actionable: Can be fixed with reasonable effort in this PR's scope
Ignore theoretical issues that require multiple unlikely conditions or malicious input patterns.
Use the "would this bother a pragmatic senior developer?" test.
Maximum chain of assumptions: 2 levels deep. Skip exotic input combinations that violate documented assumptions.
**Feedback style:**
- Provide specific code examples or line references showing the issue
- Suggest concrete fixes with code snippets where helpful
- Keep total feedback under 500 words
- Use section headers with emojis and horizontal dividers (---)
- If no improvements needed in a category, simply state "No issues found"
- Use neutral language; focus on the code, not the author
- If the PR looks good overall, say so clearly rather than forcing criticism
**Comment Management (IMPORTANT):**
Post your review using this command, which will edit your last comment if one exists, or create a new one:
```bash
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --edit-last --create-if-none --body "<review>"
```
Ensure proper escaping of quotes and special characters in the comment body. Use single quotes around the body and escape any single quotes inside with '\''
claude_args: |
--allowedTools "Read,Bash(gh pr:*),Grep,Glob"