claude-code-action icon indicating copy to clipboard operation
claude-code-action copied to clipboard

Not Updating Pull Request Comments

Open BillChirico opened this issue 4 months ago • 4 comments

Describe the bug The job successfully completes, but it does not update the GitHub comment on the pull request.

Image

To Reproduce Steps to reproduce the behavior:

  1. Install my workflow
  2. Trigger the workflow by tagging the bot to review it
  3. Wait for job to invoke and finish
  4. Comment gets stuck
Image

Expected behavior The original comment to be updated.

Screenshots See above

Workflow yml file

name: Claude Code Review
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned]
  pull_request:
    types: [opened, synchronize, ready_for_review, reopened]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  review:
    timeout-minutes: 10
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      issues: write
      id-token: write
      actions: read
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          track_progress: true
          prompt: |
            REPO: ${{ github.repository }}
            PR NUMBER: ${{ github.event.pull_request.number }}
            
            # Review PR #${{ github.event.pull_request.number }} in ${{ github.repository }} against our team checklist:

            ## Code Quality
            - [ ] Code follows our style guide
            - [ ] No commented-out code
            - [ ] Meaningful variable names
            - [ ] DRY principle followed
            - [ ] SOLID principle followed
            - [ ] Code is properly formatted and adheres to the editorconfig
            - [ ] Doesn't introduce new warnings or errors
            - [ ] Use meaningful variable and function names (avoid single letters except for loop counters)
            - [ ] Remove unused code and commented-out code blocks

            ## Testing
            - [ ] Unit tests for new functions
            - [ ] Integration tests for new endpoints
            - [ ] Edge cases covered
            - [ ] Test coverage > 60%

            ## Documentation
            - [ ] README updated if needed
            - [ ] CLAUDE updated if needed
            - [ ] API docs updated
            - [ ] Inline comments for complex logic
            - [ ] CHANGELOG.md updated
            - [ ] Method intellisense (XML) comments
            - [ ] Pull request description should have an issue attached to it that it can close after merging

            ## Security
            - [ ] No hardcoded credentials
            - [ ] Input validation implemented
            - [ ] Proper error handling
            - [ ] No sensitive data in logs

            ## Logging
            - [ ] Proper logging implemented
            - [ ] Logging with Sentry handled correctly
            - [ ] User-friendly error messages
            - [ ] Metrics/telemetry added for new features
            - [ ] Health check endpoints updated

            ## Dependencies
            - [ ] New dependencies justified
            - [ ] No known vulnerabilities

            ## Breaking Changes
            - [ ] Breaking changes documented
            - [ ] Migration guide provided
            - [ ] Deprecated features marked

            ## Git Hygiene
            - [ ] Commit messages are clear and conform to conventional commits (https://www.conventionalcommits.org/en/v1.0.0/ and https://medium.com/neudesic-innovation/conventional-commits-a-better-way-78d6785c2e08)
            - [ ] Commit messages should contain `<type>[optional scope]: <description>`
            - [ ] Refrain from using emojis
            - [ ] No merge commits (if using rebase workflow)
            - [ ] Branch is up to date with base
            - [ ] For description, use the future tense. Instead of fixed some bug, write fix some bug

            ## Code Review Specific
            - [ ] PR description is clear and complete
            - [ ] Screenshots/recordings for UI changes
            - [ ] Related issues linked
            - [ ] Deployment notes provided

            For each item, check if it's satisfied and comment on any that need attention.
            Post a summary comment with checklist results. Feel free to use emojis to make it easier to read.

          claude_args: |
            --mcp-config '{"mcpServers":{"sequential-thinking":{"command":"npx","args":["-y","@modelcontextprotocol/server-sequential-thinking"]},"fetch":{"command":"npx","args":["-y","@modelcontextprotocol/server-fetch"]},"memory":{"command":"npx","args":["-y","@modelcontextprotocol/server-memory"]},"github":{"command":"npx","args":["-y","@modelcontextprotocol/server-github"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"${{ secrets.GITHUB_TOKEN }}"}},"filesystem":{"command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","${{ github.workspace }}"]}}}'
            --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Read,Write,Edit,Bash(git:*),mcp__sequential-thinking__sequentialthinking,mcp__fetch__fetch,mcp__memory__create_entities,mcp__memory__create_relations,mcp__github__create_or_update_file,mcp__github__search_repositories,mcp__github__create_repository,mcp__github__get_file_contents,mcp__github__push_files,mcp__github__create_issue,mcp__github__create_pull_request,mcp__github__fork_repository,mcp__github__create_branch,mcp__filesystem__read_file,mcp__filesystem__read_multiple_files,mcp__filesystem__write_file,mcp__filesystem__edit_file,mcp__filesystem__create_directory,mcp__filesystem__list_directory,mcp__filesystem__move_file,mcp__filesystem__search_files,mcp__filesystem__get_file_info,WebFetch"
            --model claude-sonnet-4-5-20250929
            --max-turns 15

API Provider

[X] Anthropic First-Party API (default) [ ] AWS Bedrock [ ] GCP Vertex

Additional context This wasn't happening when I was using the beta version

BillChirico avatar Oct 03 '25 16:10 BillChirico

with the beta version did you have to allow tools for it to update the existing sticky comment? For me claude never updates the existing sticky comment

shafty023 avatar Oct 03 '25 18:10 shafty023

with the beta version did you have to allow tools for it to update the existing sticky comment? For me claude never updates the existing sticky comment

Nope, it just did it automatically. Here's my beta version:

name: Claude Code Review

on:
  pull_request:
    types: [opened, synchronize]
    # Optional: Only run on specific file changes
    # paths:
    #   - "src/**/*.ts"
    #   - "src/**/*.tsx"
    #   - "src/**/*.js"
    #   - "src/**/*.jsx"

jobs:
  claude-review:
    # Optional: Filter by PR author
    # if: |
    #   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@v5
        with:
          fetch-depth: 1

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

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

          # 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.

          # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
          # 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]')

BillChirico avatar Oct 03 '25 18:10 BillChirico

Now it's failing with no error given

BillChirico avatar Oct 04 '25 23:10 BillChirico

I ran into this issue as well, removing --max-turns seems to have done the trick for me.

Obviously not ideal as I want to limit the number of turns for cost optimization reasons.

thisisanto avatar Nov 05 '25 05:11 thisisanto