name: Claude Experimental Review Mode

on:
  issue_comment:
    types: [created]

jobs:
  code-review:
    # Run when someone comments "@claude review" on a PR conversation
    if: |
      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 (Experimental)
        uses: anthropics/claude-code-action@beta
        with:
          mode: experimental-review
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          timeout_minutes: "30"
          custom_instructions: |
            Focus on:
            - Code quality and maintainability
            - Security vulnerabilities
            - Performance issues
            - Best practices and design patterns

            Be constructive and provide specific suggestions for improvements.
            Use GitHub's suggestion format when proposing code changes.
