claude-code-action/examples/pr-review-filtered-paths.yml
Ashwin Bhat df10c4692a
fix: add checkHumanActor to agent mode and concurrency to workflow examples
Fixes issue #641 where users were getting banned due to rapid successive
Claude runs triggered by the synchronize event.

Changes:
- Add checkHumanActor call to agent mode's prepare() method to reject
  bot-triggered workflows unless explicitly allowed via allowed_bots
- Update checkHumanActor to accept GitHubContext (union type) instead
  of just ParsedGitHubContext
- Add concurrency protection to all PR review workflow examples to
  prevent multiple reviews running simultaneously on the same PR
- Add tests for bot rejection/allowance in agent mode

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-15 17:03:07 -08:00

55 lines
1.7 KiB
YAML

name: Claude Review - Path Specific
on:
pull_request:
types: [opened, synchronize]
paths:
# Only run when specific paths are modified
- "src/**/*.js"
- "src/**/*.ts"
- "api/**/*.py"
# You can add more specific patterns as needed
# Prevent multiple reviews from running simultaneously on the same PR
concurrency:
group: claude-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
claude-review-paths:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
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:
- Code quality and adherence to best practices
- Potential bugs or edge cases
- Performance considerations
- Security implications
- Suggestions for improvement
Since this PR touches critical source code paths, please be thorough
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:*)"