diff --git a/.github/workflows/claude.yaml b/.github/workflows/claude.yaml index 3b0b3cb4..e52cadfe 100644 --- a/.github/workflows/claude.yaml +++ b/.github/workflows/claude.yaml @@ -19,14 +19,14 @@ jobs: (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) runs-on: ubuntu-latest permissions: - issues: read - actions: read # Required for Claude to read CI results on PRs - contents: read + contents: write + pull-requests: write + issues: write id-token: write - pull-requests: read + actions: read # Required for Claude to read CI results on PRs steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 1 @@ -34,10 +34,10 @@ jobs: id: claude uses: anthropics/claude-code-action@v1 with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + assignee_trigger: "claude-bot" claude_args: | - --max-turns 5 --model claude-opus-4-6 - # This is an optional setting that allows Claude to read CI results on PRs - additional_permissions: | - actions: read + --max-turns 5 + --allowedTools "Bash(dart pub get),Bash(dart test:*),Bash(dart analyze:*),Bash(dart format:*)" + --system-prompt "Follow our coding standards. Ensure all new code has tests. Use TypeScript for new files." diff --git a/.github/workflows/claude_code_review.yaml b/.github/workflows/claude_code_review.yaml index 9be74340..3534d418 100644 --- a/.github/workflows/claude_code_review.yaml +++ b/.github/workflows/claude_code_review.yaml @@ -1,33 +1,44 @@ name: claude_code_review on: - pull_request_target: + pull_request: types: [opened, synchronize, ready_for_review, reopened] jobs: - claude-review: + review-with-tracking: runs-on: ubuntu-latest permissions: - issues: read contents: read + pull-requests: write id-token: write - pull-requests: read - steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: - ref: refs/pull/${{ github.event.pull_request.number }}/merge fetch-depth: 1 - - name: Run Claude Code Review - id: claude-review + - name: PR Review uses: anthropics/claude-code-action@v1 with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - plugin_marketplaces: "https://github.com/anthropics/claude-code.git" - plugins: "code-review@claude-code-plugins" - prompt: "/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}" + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + track_progress: true + 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: | - --max-turns 5 - --model claude-opus-4-6 + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"