fix: skip commentBody validation for Forgejo review comment events

Forgejo's pull_request_review_comment payload doesn't include the
comment body. The Forgejo data fetcher retrieves it via REST instead.
Skip the COMMENT_BODY required check on Forgejo to avoid crashing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vlad MocanuandClaude Opus 4.6 committed 2026-02-26 08:42:22 +02:00
1 parent 9d8c96f01e
commit e73c881c64
1 file changed
+4 -2
+4 -2
View File
@@ -178,7 +178,9 @@ export function prepareContext(
"IS_PR must be true for pull_request_review_comment event", "IS_PR must be true for pull_request_review_comment event",
); );
} }
if (!commentBody) { // Forgejo's pull_request_review_comment payload lacks the comment body;
// the Forgejo data fetcher retrieves it via REST instead.
if (!commentBody && detectPlatform() !== "forgejo") {
throw new Error( throw new Error(
"COMMENT_BODY is required for pull_request_review_comment event", "COMMENT_BODY is required for pull_request_review_comment event",
); );
@@ -188,7 +190,7 @@ export function prepareContext(
isPR: true, isPR: true,
prNumber, prNumber,
...(commentId && { commentId }), ...(commentId && { commentId }),
commentBody, commentBody: commentBody || "",
...(claudeBranch && { claudeBranch }), ...(claudeBranch && { claudeBranch }),
...(baseBranch && { baseBranch }), ...(baseBranch && { baseBranch }),
}; };