Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
# 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: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -33,45 +33,44 @@ jobs:

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@beta
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
# model: "claude-opus-4-20250514"

# Direct prompt for automated review (no @claude mention needed)
direct_prompt: |
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

Be constructive and helpful in your feedback. Ensure that the code follows the repo's coding standards as written in the README.md guides.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
use_sticky_comment: true

# Add specific tools for running tests/linting and GitHub CLI commands
claude_args: '--use-sticky-comment --allowed-tools "Bash(uvx pre-commit run --all-files),Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

# Optional: Customize review based on file types
# direct_prompt: |
# prompt: |
# Review this PR focusing on:
# - For TypeScript files: Type safety and proper interface usage
# - For API endpoints: Security, input validation, and error handling
# - For React components: Performance, accessibility, and best practices
# - For tests: Coverage, edge cases, and test quality

# Optional: Different prompts for different authors
# direct_prompt: |
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}

# Optional: Add specific tools for running tests or linting
allowed_tools: "Bash(uvx pre-commit run --all-files)"

# Optional: Skip review for certain conditions
# if: |
!contains(github.event.pull_request.title, '[skip-review]') && !contains(github.event.pull_request.title, '[WIP]')

# Optional: Different prompts for different authors (example)
# You can conditionally set the prompt based on PR author association

# Optional: Skip review for certain conditions (example)
# Add a job-level if condition to skip PRs with [skip-review] or [WIP] in title

36 changes: 17 additions & 19 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,43 @@ jobs:

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@beta
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
# model: "claude-opus-4-20250514"

# Optional: Customize the trigger phrase (default: @claude)
# trigger_phrase: "/claude"
# claude_args: '--trigger-phrase "/claude"'

# Optional: Trigger when specific user is assigned to an issue
assignee_trigger: "claude-bot"

# Optional: Allow Claude to run specific commands
allowed_tools: "Bash(uvx pre-commit run --all-files),Bash(python ci/check_*.py)"

# Optional: Add custom instructions for Claude to customize its behavior for your project
custom_instructions: |
This is a Python/Bash tools repository. When reviewing or writing code:

# claude_args: '--assignee-trigger "claude-bot"'

# Optional: Allow Claude to run specific commands and add custom instructions
claude_args: >-
--allowed-tools "Bash(uvx pre-commit run --all-files),Bash(python ci/check_*.py),Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"
--custom-instructions "This is a Python/Bash tools repository. When reviewing or writing code:

**Python Standards:**
- All scripts must have proper main guards (if __name__ == "__main__")
- All scripts must have proper main guards (if __name__ == \"__main__\")
- Avoid 'Any' type hints
- Follow PEP 8 and Python best practices

**Bash Standards:**
- Ensure scripts are safe and portable
- Use proper error handling
- Include helpful comments

**General:**
- Check the README.md files in each directory for specific guidelines
- Run CI checks when appropriate to verify compliance
- Focus on code quality, security, and maintainability
- Focus on code quality, security, and maintainability"

# Optional: Custom environment variables for Claude
# claude_env: |
# NODE_ENV: test
Expand Down
Loading