Skip to content

Conversation

@snomiao
Copy link
Member

@snomiao snomiao commented Sep 10, 2025

Problem

The claude-review label workflow wasn't working in PR #5458 because the workflow file was using deprecated input parameters from v0.x of the anthropics/claude-code-action.

Root Cause

According to the migration guide, the action underwent significant changes from v0.x to v1.0. Our workflow was still using the old v0.x parameters:

  • direct_prompt instead of prompt
  • max_turns as a direct input instead of through claude_args
  • timeout_minutes as a direct input (should be set at job level or via claude_args)
  • allowed_tools instead of using claude_args or additional_permissions

These deprecated parameters are not recognized by v1.0+, causing the action to fail silently with a warning about unexpected inputs.

Solution

  1. Updated parameters following the v0.x to v1.0 migration guide:

    • Changed direct_promptprompt
    • Moved max_turns and timeout to claude_args parameter as --max-turns 256 --timeout 30
    • Changed allowed_toolsadditional_permissions
  2. Pinned version to v1.0.6 instead of using @main to prevent future breakage from unexpected updates

Testing

This should be tested by:

  1. Merging this PR
  2. Adding the claude-review label to a test PR
  3. Verifying that Claude actually reviews the PR and posts comments

References

🤖 Generated with Claude Code

- Changed 'direct_prompt' to 'prompt' (correct parameter name)
- Moved max_turns and timeout to claude_args parameter
- Changed allowed_tools to additional_permissions parameter

The workflow was failing silently because it was using invalid input parameters
that the claude-code-action doesn't recognize.

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

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link

github-actions bot commented Sep 10, 2025

🎭 Playwright Test Results

Tests completed successfully!

⏰ Completed at: 09/10/2025, 06:16:42 AM UTC

📊 Test Reports by Browser


🎉 Click on the links above to view detailed test results for each browser configuration.

Using @main tag could cause unexpected breakage when the action updates.
Pinning to a specific version ensures stability.
@snomiao
Copy link
Member Author

snomiao commented Sep 10, 2025

Review: Migration to claude-code-action v1.0

I've reviewed this PR against the official migration guide and found a few issues:

✅ Correctly Fixed

  1. direct_promptprompt - Correctly migrated ✓
  2. max_turnsclaude_args - Correctly moved to --max-turns 256
  3. Version pinning - Good practice to pin to v1.0.6

⚠️ Issues to Address

  1. allowed_tools parameter: According to the migration guide, this should be --allowedTools in claude_args, not additional_permissions. The correct migration would be:

    claude_args: "--max-turns 256 --timeout 30 --allowedTools 'Bash(git:*),Bash(gh api:*),Bash(gh pr:*),Bash(gh repo:*),Bash(jq:*),Bash(echo:*),Read,Write,Edit,Glob,Grep,WebFetch'"
  2. timeout parameter: The migration guide states that timeout should be set at the job level as timeout-minutes, not in claude_args. The --timeout flag in claude_args might not work as expected.

📝 Recommended Changes

claude-review:
  needs: wait-for-ci
  if: needs.wait-for-ci.outputs.should-proceed == 'true'
  runs-on: ubuntu-latest
  timeout-minutes: 30  # Add this at job level
  steps:
    # ... other steps ...
    
    - name: Run Claude PR Review
      uses: anthropics/[email protected]
      with:
        label_trigger: "claude-review"
        prompt: |
          Read the file .claude/commands/comprehensive-pr-review.md and follow ALL the instructions exactly. 
          
          CRITICAL: You must post individual inline comments using the gh api commands shown in the file. 
          DO NOT create a summary comment. 
          Each issue must be posted as a separate inline comment on the specific line of code.
        anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
        claude_args: "--max-turns 256 --allowedTools 'Bash(git:*),Bash(gh api:*),Bash(gh pr:*),Bash(gh repo:*),Bash(jq:*),Bash(echo:*),Read,Write,Edit,Glob,Grep,WebFetch'"

The additional_permissions parameter doesn't appear in the migration guide or the valid inputs list, so it might be ignored or cause issues.

- Moved timeout-minutes to job level (not in claude_args)
- Changed additional_permissions to --allowedTools in claude_args
- Fixed tool specification format per migration guide

These changes follow the official v0.x to v1.0 migration guide exactly.
@snomiao
Copy link
Member Author

snomiao commented Sep 10, 2025

✅ Update: All Issues Fixed

The review feedback has been implemented in commit 5f6df80:

Applied Fixes

  1. ✅ Moved timeout to job level: Added timeout-minutes: 30 at the job level instead of in claude_args
  2. ✅ Fixed allowed tools parameter: Changed to --allowedTools in claude_args with proper format
  3. ✅ Removed invalid parameter: Removed additional_permissions which isn't a valid input

Current Implementation (Correct)

claude-review:
  needs: wait-for-ci
  if: needs.wait-for-ci.outputs.should-proceed == 'true'
  runs-on: ubuntu-latest
  timeout-minutes: 30  # ✅ At job level as per migration guide
  steps:
    # ... other steps ...
    
    - name: Run Claude PR Review
      uses: anthropics/[email protected]  # ✅ Pinned version
      with:
        label_trigger: "claude-review"
        prompt: |  # ✅ Correct parameter name (was direct_prompt)
          Read the file .claude/commands/comprehensive-pr-review.md and follow ALL the instructions exactly. 
          
          CRITICAL: You must post individual inline comments using the gh api commands shown in the file. 
          DO NOT create a summary comment. 
          Each issue must be posted as a separate inline comment on the specific line of code.
        anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
        claude_args: "--max-turns 256 --allowedTools 'Bash(git:*),Bash(gh api:*),Bash(gh pr:*),Bash(gh repo:*),Bash(jq:*),Bash(echo:*),Read,Write,Edit,Glob,Grep,WebFetch'"  # ✅ Correct format per migration guide

The workflow now fully complies with the v0.x to v1.0 migration guide and should work correctly when the claude-review label is applied.

@snomiao snomiao marked this pull request as ready for review September 10, 2025 06:03
@snomiao snomiao requested a review from a team as a code owner September 10, 2025 06:03
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 10, 2025
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY!

@christian-byrne christian-byrne merged commit 0803347 into main Sep 10, 2025
21 checks passed
@christian-byrne christian-byrne deleted the sno-fix-claude-review-label branch September 10, 2025 06:25
arjansingh pushed a commit that referenced this pull request Sep 11, 2025
#5473)

* fix: update Claude PR Review workflow to use correct action parameters

- Changed 'direct_prompt' to 'prompt' (correct parameter name)
- Moved max_turns and timeout to claude_args parameter
- Changed allowed_tools to additional_permissions parameter

The workflow was failing silently because it was using invalid input parameters
that the claude-code-action doesn't recognize.

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

Co-Authored-By: Claude <[email protected]>

* fix: pin claude-code-action to v1.0.6 to prevent future breakage

Using @main tag could cause unexpected breakage when the action updates.
Pinning to a specific version ensures stability.

* fix: apply review feedback - correct migration to v1.0 format

- Moved timeout-minutes to job level (not in claude_args)
- Changed additional_permissions to --allowedTools in claude_args
- Fixed tool specification format per migration guide

These changes follow the official v0.x to v1.0 migration guide exactly.

---------

Co-authored-by: Claude <[email protected]>
snomiao added a commit that referenced this pull request Sep 12, 2025
#5473)

* fix: update Claude PR Review workflow to use correct action parameters

- Changed 'direct_prompt' to 'prompt' (correct parameter name)
- Moved max_turns and timeout to claude_args parameter
- Changed allowed_tools to additional_permissions parameter

The workflow was failing silently because it was using invalid input parameters
that the claude-code-action doesn't recognize.

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

Co-Authored-By: Claude <[email protected]>

* fix: pin claude-code-action to v1.0.6 to prevent future breakage

Using @main tag could cause unexpected breakage when the action updates.
Pinning to a specific version ensures stability.

* fix: apply review feedback - correct migration to v1.0 format

- Moved timeout-minutes to job level (not in claude_args)
- Changed additional_permissions to --allowedTools in claude_args
- Fixed tool specification format per migration guide

These changes follow the official v0.x to v1.0 migration guide exactly.

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:CI/CD size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants