Skip to content

Commit c476b60

Browse files
claudeondrejmirtes
authored andcommitted
Split claude react-on-comment into two jobs to avoid expensive setup
Add a lightweight check-trigger job on ubuntu-latest that checks if the comment contains the @phpstan-bot trigger phrase. The expensive react job (setup-php, composer install on blacksmith runner) only runs when the trigger phrase is actually present. https://claude.ai/code/session_01T86RqyQoZyKWyG4MUnf7FC
1 parent 7c6309c commit c476b60

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/claude-react-on-comment.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,28 @@ concurrency:
1919
cancel-in-progress: false
2020

2121
jobs:
22+
check-trigger:
23+
name: "Check trigger phrase"
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 1
26+
outputs:
27+
triggered: ${{ steps.check.outputs.triggered }}
28+
steps:
29+
- name: "Check for trigger phrase"
30+
id: check
31+
env:
32+
COMMENT_BODY: ${{ github.event.comment.body || github.event.review.body || '' }}
33+
run: |
34+
if echo "$COMMENT_BODY" | grep -qF "@phpstan-bot"; then
35+
echo "triggered=true" >> "$GITHUB_OUTPUT"
36+
else
37+
echo "triggered=false" >> "$GITHUB_OUTPUT"
38+
fi
39+
2240
react:
2341
name: "React on comment"
42+
needs: check-trigger
43+
if: needs.check-trigger.outputs.triggered == 'true'
2444
runs-on: blacksmith-4vcpu-ubuntu-2404
2545
timeout-minutes: 60
2646

0 commit comments

Comments
 (0)