From 42f6508d4978ed4e1ce7b873b4b997e0aee09702 Mon Sep 17 00:00:00 2001 From: Vlad Mocanu Date: Thu, 26 Feb 2026 10:05:20 +0200 Subject: [PATCH] fix: gate Forgejo review/comment triggers on @claude mention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .forgejo/workflows/claude.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/claude.yml b/.forgejo/workflows/claude.yml index 7dadd18..39f47cf 100644 --- a/.forgejo/workflows/claude.yml +++ b/.forgejo/workflows/claude.yml @@ -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