Skip to content

Add actor-based comment filtering to reduce token usage and API costs #845

@ranyhb

Description

@ranyhb

Problem

When PRs have many bot comments (dependabot, renovate, CI bots, etc.), Claude processes all of them, leading to:

  • High token usage and increased Anthropic API costs
  • Slower response times
  • Claude potentially getting distracted by bot noise when reviewing code changes

Example: A PR with 50 dependabot + 20 renovate + 10 human comments = Claude processes all 80 comments unnecessarily.

Proposed Solution

Add two new action inputs to filter comments based on comment author username:

  • include_comments_by_actor: Only process comments from specified actors
  • exclude_comments_by_actor: Exclude comments from specified actors

Both should support wildcard patterns like *[bot] to match all bot accounts.

Benefits

  • Token cost reduction: Up to 88% reduction in bot-heavy PRs
  • Noise elimination: Claude focuses only on relevant human feedback
  • Faster responses: Less data to process
  • Lower API costs: Fewer tokens sent to Anthropic API

Implementation

See PR #812 for implementation details.

Example Usage

- uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    exclude_comments_by_actor: "*[bot]"  # Exclude all bots

Closes #812

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions