Skip to content

Commit 1a458e6

Browse files
phpstan-botclaude
authored andcommitted
Add claude-react-on-comment workflow
Add the Claude bot workflow that reacts to @phpstan-bot mentions. Triggers on issue comments, PR reviews, PR review comments, and newly opened issues. The COMMENT_BODY includes a fallback chain to support all trigger contexts (comment body, review body, and issue body). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d4e053 commit 1a458e6

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: "Claude React on comment"
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
issue_comment:
7+
types: [created]
8+
pull_request_review:
9+
types: [submitted]
10+
pull_request_review_comment:
11+
types: [created]
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
issues: write
17+
actions: read
18+
19+
concurrency:
20+
group: claude-pr-reactions-${{ github.event.pull_request.number || github.event.issue.number }}
21+
cancel-in-progress: false
22+
23+
jobs:
24+
check-trigger:
25+
name: "Check trigger phrase"
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 1
28+
outputs:
29+
triggered: ${{ steps.check.outputs.triggered }}
30+
steps:
31+
- name: "Check for trigger phrase"
32+
id: check
33+
env:
34+
COMMENT_BODY: ${{ github.event.comment.body || github.event.review.body || github.event.issue.body || '' }}
35+
run: |
36+
if echo "$COMMENT_BODY" | grep -qF "@phpstan-bot"; then
37+
echo "triggered=true" >> "$GITHUB_OUTPUT"
38+
else
39+
echo "triggered=false" >> "$GITHUB_OUTPUT"
40+
fi
41+
42+
react:
43+
name: "React on comment"
44+
needs: check-trigger
45+
if: needs.check-trigger.outputs.triggered == 'true'
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 60
48+
49+
steps:
50+
- name: "Checkout"
51+
uses: actions/checkout@v4
52+
with:
53+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
54+
55+
- name: "React to feedback"
56+
uses: anthropics/claude-code-action@v1
57+
with:
58+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
59+
github_token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
60+
trigger_phrase: "@phpstan-bot"
61+
claude_args: "--model claude-opus-4-6"
62+
bot_name: "phpstan-bot"
63+
bot_id: "79867460"
64+
additional_permissions: |
65+
actions: read

0 commit comments

Comments
 (0)