anthropics / anthropics/claude-code-action

Github Bot PR comment doesn't trigger Claude even though invoked

Đang mở
#591 19 bình luận 3 reaction 0 người được giao Xem trên GitHub
area:permissions bug p2
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

`**Describe` the bug**
When github-actions bot comments a PR with `@claude solve this ticket` claude marks the comment with 👀 but doesn't kick off the workflow.
When I follow up `@claude solve this ticket` it kicks off the workflow twice. One for the bot comment and one for mine.

**To Reproduce**
Steps to reproduce the behavior:

I have the following workflow that creates a new branch, a new PR and then comment on the PR `@claude solve this ticket`.

```
name: Simple Ticket Workflow
on:
workflow_dispatch:
inputs:
id:
description: 'Ticket ID'
required: true
type: string
title:
description: 'Ticket title'
required: true
type: string
description:
description: 'Ticket description'
required: true
type: string

permissions:
contents: write
pull-requests: write

jobs:
create-ticket-pr:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure Git
run: |
git config --global user.name "mario"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Create branch
run: |
# Create branch name from ticket ID and title
BRANCH_NAME="${{ github.event.inputs.id }}-$(echo "${{ github.event.inputs.title }}" | head -c 30 | sed 's/[^a-zA-Z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')"

# Check if branch exists remotely and make unique if needed
git fetch origin
if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
BRANCH_NAME="${BRANCH_NAME}-${TIMESTAMP}"
fi

echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "Creating branch: $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"

- name: Create ticket file
run: |
# Create a simple ticket tracking file
mkdir -p tickets
cat > tickets/${{ github.event.inputs.id }}.md << EOF
# ${{ github.event.inputs.id }}: ${{ github.event.inputs.title }}

**Title:** ${{ github.event.inputs.title }}
**Description:** ${{ github.event.inputs.description }}

**Created:** $(date)
**Status:** In Progress
**Branch:** $BRANCH_NAME
EOF

git add tickets/${{ github.event.inputs.id }}.md
git commit -m "${{ github.event.inputs.id }}: ${{ github.event.inputs.title }}"

- name: Push branch
run: |
git push origin "$BRANCH_NAME"

- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TICKET_ID: ${{ github.event.inputs.id }}
TICKET_TITLE: ${{ github.event.inputs.title }}
TICKET_DESCRIPTION: ${{ github.event.inputs.description }}
run: |
# Create PR title and body using environment variables to avoid injection
PR_TITLE="${TICKET_ID}: ${TICKET_TITLE}"
PR_BODY="🎫 **Ticket Information**

**ID:** ${TICKET_ID}
**Title:** ${TICKET_TITLE}
**Description:** ${TICKET_DESCRIPTION}
**Created by:** mario (automated)
**Date:** $(date)

This PR was created automatically for the ticket above."

PR_URL=$(gh pr create \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--head "$BRANCH_NAME" \
--base main)

echo "PR_URL=$PR_URL" >> $GITHUB_ENV

- name: Add Claude assignment comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting 15 seconds for PR to be fully created..."
sleep 15
gh pr comment "$BRANCH_NAME" --body "@claude solve this ticket"
```

**Expected behavior**
Workflow is kicked off immediately when github-actions bot comments a PR with `@claude solve this ticket`

**Screenshots**
Github PR
Image

Github Actions

Image

**Workflow yml file**
```
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]

env:
ACCOUNT_ID: secret
GITHUB_ACTION_ROLE_ARN: secret

permissions:
id-token: write
contents: write
pull-requests: write
actions: write

jobs:
claude:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.GITHUB_ACTION_ROLE_ARN }}
role-session-name: mario-github-actions
aws-region: 'us-east-1'
- name: Claude Action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: anthropics/claude-code-action@v1
with:
use_bedrock: "true"
```

**API Provider**

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

**Additional context**
I am creating an integration that from Atlassian Jira users can hand this task to Claude in GH

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.