Skip to content

Commit eb4f9f7

Browse files
committed
Refactor claude comment trigger logic
1 parent 479ff62 commit eb4f9f7

1 file changed

Lines changed: 4 additions & 29 deletions

File tree

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

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,11 @@ permissions:
1616
contents: read
1717

1818
jobs:
19-
check-trigger:
20-
name: "Check trigger phrase"
21-
runs-on: ubuntu-latest
22-
timeout-minutes: 1
23-
outputs:
24-
triggered: ${{ steps.check.outputs.triggered }}
25-
steps:
26-
- name: Harden the runner (Audit all outbound calls)
27-
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
28-
with:
29-
egress-policy: audit
30-
31-
- name: "Check for trigger phrase"
32-
id: check
33-
env:
34-
COMMENT_BODY: ${{ github.event.comment.body || github.event.review.body || '' }}
35-
COMMENT_USER: ${{ github.event.comment.user.login || github.event.review.user.login || '' }}
36-
run: |
37-
if [ "$COMMENT_USER" = "phpstan-bot" ]; then
38-
echo "triggered=false" >> "$GITHUB_OUTPUT"
39-
elif echo "$COMMENT_BODY" | grep -qF "@phpstan-bot"; then
40-
echo "triggered=true" >> "$GITHUB_OUTPUT"
41-
else
42-
echo "triggered=false" >> "$GITHUB_OUTPUT"
43-
fi
44-
4519
react:
4620
name: "React on comment"
47-
needs: check-trigger
48-
if: needs.check-trigger.outputs.triggered == 'true'
21+
if: >-
22+
(github.event.comment.user.login || github.event.review.user.login || '') != 'phpstan-bot' &&
23+
contains(github.event.comment.body || github.event.review.body || '', '@phpstan-bot')
4924
runs-on: blacksmith-4vcpu-ubuntu-2404
5025
timeout-minutes: 60
5126
permissions:
@@ -61,7 +36,7 @@ jobs:
6136
egress-policy: audit
6237

6338
- name: "Checkout"
64-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6540
with:
6641
fetch-depth: 0
6742

0 commit comments

Comments
 (0)