Skip to content

Bot comment still triggers workflow run even with user.type != 'Bot' condition #794

@tangyu

Description

@tangyu

Summary

When using github.event.comment.user.type != 'Bot' in the job's if condition, the bot's comment still triggers a workflow run (though the job gets skipped). This causes two workflow runs for every @claude mention.

Current Behavior

  1. User comments @claude review on a PR
  2. Workflow run Modify base action #1 starts (triggered by user comment)
  3. Claude bot responds with a comment
  4. Workflow run Modify action name #2 starts (triggered by bot comment), but job is skipped due to user.type != 'Bot' condition

The problem is that the workflow run is still created, which:

Workflow Configuration

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]

concurrency:
  group: ${{ github.workflow }}-${{ github.event.comment.id || github.event.issue.number || github.run_id }}
  cancel-in-progress: false

jobs:
  respond-to-mention:
    if: |
      (github.event_name == 'issue_comment' ||
       github.event_name == 'pull_request_review_comment') &&
      contains(github.event.comment.body, '@claude') &&
      github.event.comment.user.type != 'Bot'
    runs-on: ubuntu-latest
    # ...

Example Runs

Run Triggered By Status Duration
#15 claude[bot] skipped 1s
#14 tangyu success 2m 36s

Both runs were triggered by the same @claude mention - #14 by the user, #15 by the bot's response.

Expected Behavior

Only one workflow run should be created per @claude mention.

Suggested Fix

As suggested in #625, using github.actor != 'claude[bot]' at the workflow level might help:

jobs:
  respond-to-mention:
    if: |
      github.actor != 'claude[bot]' &&
      (github.event_name == 'issue_comment' ||
       github.event_name == 'pull_request_review_comment') &&
      contains(github.event.comment.body, '@claude')

However, this still creates a workflow run that gets skipped.

Ideally, GitHub Actions would support filtering at the trigger level based on the comment author, but this is a GitHub limitation.

Workaround

We're currently using:

  • github.event.comment.user.type != 'Bot' to skip the job
  • cancel-in-progress: false to prevent the skipped run from canceling the real one
  • github.event.comment.id in concurrency group to isolate runs

This works, but results in duplicate (skipped) workflow runs in the Actions tab.

Related Issues

Environment

  • claude-code-action: v1
  • Trigger: issue_comment, pull_request_review_comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions