fix: gate Forgejo review/comment triggers on @claude mention

Previously, all pull_request_comment events on Forgejo triggered the
full Claude pipeline unconditionally — both in the workflow if-condition
and in trigger.ts. This wasted CI resources and API credits on reviews
without @claude mentions (e.g. plain "LGTM" reviews).

Workflow: add @claude check via contains() on comment.body and review.body.
Trigger validation: replace blind auto-trigger with payload-aware check
that inspects available body fields, falling back only when no body exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 11:32:36 +02:00
1 parent 8754cc0181
commit 42f6508d49
1 file changed
+2 -1
+2 -1
View File
@@ -26,7 +26,8 @@ jobs:
# despite action being 'labeled'). Let all through; trigger.ts validates.
if: >-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' || github.event_name == 'pull_request_comment') ||
(github.event_name == 'pull_request_review_comment' || github.event_name == 'pull_request_comment') &&
(contains(github.event.comment.body, '@claude') || contains(github.event.review.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues')
runs-on: grunt