From 3d0f1d31e0ff4e9037f998115f129de6b0588f2e Mon Sep 17 00:00:00 2001 From: Ajit Pratap Singh Date: Sat, 10 Oct 2026 23:22:09 +0530 Subject: [PATCH] ci(claude): upgrade claude-code-action from @beta to @v1 @beta checks out the PR head branch by name from origin, so @claude on a fork PR fails with 'couldn't find remote ref' -- or, when origin has a branch with the same name, silently checks out the wrong code. v1 fetches fork PRs via refs/pull/N/head. Migrate inputs per the v1 migration guide: direct_prompt -> prompt (with REPO/PR NUMBER context), model -> claude_args --model, and give the automatic review its comment tools. track_progress + use_sticky_comment keep the existing single progress comment. Drop commented-out examples that use removed v0 inputs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VCRwrpJY25CRtyTcu6aD8V --- .github/workflows/claude-code-review.yml | 44 ++++++++---------------- .github/workflows/claude.yml | 27 +++------------ 2 files changed, 18 insertions(+), 53 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 0597a299..ae00449a 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -27,46 +27,30 @@ 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 }} github_token: ${{ secrets.GITHUB_TOKEN }} - # Pin the model: the action's built-in default (claude-sonnet-4-20250514) is retired and returns 404 - model: "claude-sonnet-5-5" + # Keep the v0-style sticky progress comment that the review is posted into + # (v1 rejects track_progress on workflow_dispatch, so only enable it for PR events) + track_progress: ${{ github.event_name == 'pull_request' }} + use_sticky_comment: true + + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} - # Direct prompt for automated review (no @claude mention needed) - direct_prompt: | 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. - use_sticky_comment: true - - # Optional: Customize review based on file types - # direct_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(npm run test),Bash(npm run lint),Bash(npm run typecheck)" - - # Optional: Skip review for certain conditions - # if: | - # !contains(github.event.pull_request.title, '[skip-review]') && - # !contains(github.event.pull_request.title, '[WIP]') + Be constructive and helpful in your feedback. + # Pin the model: the action's built-in default can be retired (claude-sonnet-4-20250514 returned 404) + claude_args: | + --model claude-sonnet-5-5 + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 4084df51..a3b502be 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -32,33 +32,14 @@ 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 - - # Pin the model: the action's built-in default (claude-sonnet-4-20250514) is retired and returns 404 - model: "claude-sonnet-5-5" - - # Optional: Customize the trigger phrase (default: @claude) - # 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(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" - - # Optional: Add custom instructions for Claude to customize its behavior for your project - # custom_instructions: | - # Follow our coding standards - # Ensure all new code has tests - # Use TypeScript for new files - - # Optional: Custom environment variables for Claude - # claude_env: | - # NODE_ENV: test + # Pin the model: the action's built-in default can be retired (claude-sonnet-4-20250514 returned 404) + claude_args: | + --model claude-sonnet-5-5