feat: improve PR review examples with context and tools (#504)

- Add PR repository and number to review prompts
- Note that PR branch is already checked out
- Update allowed tools to use inline comments and gh CLI
- Remove experimental review mode example in favor of standardized approach

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Ashwin Bhat
2025-08-28 09:02:27 -07:00
committed by GitHub
parent 8a20581ed5
commit 0c127307fa
4 changed files with 28 additions and 48 deletions

View File

@@ -22,7 +22,12 @@ jobs:
with: with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: | prompt: |
Please review this pull request and provide comprehensive feedback. REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please review this pull request.
Note: The PR branch is already checked out in the current working directory.
Focus on: Focus on:
- Code quality and best practices - Code quality and best practices
@@ -34,7 +39,10 @@ jobs:
- Verify that README.md and docs are updated for any new features or config changes - Verify that README.md and docs are updated for any new features or config changes
Provide constructive feedback with specific suggestions for improvement. Provide constructive feedback with specific suggestions for improvement.
Use inline comments to highlight specific areas of concern. Use `gh pr comment:*` for top-level comments.
Use `mcp__github_inline_comment__create_inline_comment` to highlight specific areas of concern.
Only your GitHub comments that you post will be seen, so don't submit your review as a normal message, just as comments.
If the PR has already been reviewed, or there are no noteworthy changes, don't post anything.
claude_args: | claude_args: |
--allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff" --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"

View File

@@ -1,45 +0,0 @@
name: Claude Experimental Review Mode
on:
pull_request:
types: [opened, synchronize]
issue_comment:
types: [created]
jobs:
code-review:
# Run on PR events, or when someone comments "@claude review" on a PR
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude review'))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better diff analysis
- name: Code Review with Claude
uses: anthropics/claude-code-action@v1-dev
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# github_token not needed - uses default GITHUB_TOKEN for GitHub operations
prompt: |
Review this pull request comprehensively.
Focus on:
- Code quality and maintainability
- Security vulnerabilities
- Performance issues
- Best practices and design patterns
- Test coverage gaps
Be constructive and provide specific suggestions for improvements.
Use GitHub's suggestion format when proposing code changes.

View File

@@ -28,7 +28,13 @@ jobs:
with: with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: | prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please review this pull request focusing on the changed files. Please review this pull request focusing on the changed files.
Note: The PR branch is already checked out in the current working directory.
Provide feedback on: Provide feedback on:
- Code quality and adherence to best practices - Code quality and adherence to best practices
- Potential bugs or edge cases - Potential bugs or edge cases
@@ -38,3 +44,6 @@ jobs:
Since this PR touches critical source code paths, please be thorough Since this PR touches critical source code paths, please be thorough
in your review and provide inline comments where appropriate. in your review and provide inline comments where appropriate.
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"

View File

@@ -27,8 +27,13 @@ jobs:
with: with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: | prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Please provide a thorough review of this pull request. Please provide a thorough review of this pull request.
Note: The PR branch is already checked out in the current working directory.
Since this is from a specific author that requires careful review, Since this is from a specific author that requires careful review,
please pay extra attention to: please pay extra attention to:
- Adherence to project coding standards - Adherence to project coding standards
@@ -38,3 +43,6 @@ jobs:
- Documentation - Documentation
Provide detailed feedback and suggestions for improvement. Provide detailed feedback and suggestions for improvement.
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*)"