From bbad5183ff223fbcffe0f77d1cda997681296523 Mon Sep 17 00:00:00 2001 From: Futurize Rush <122273125+FuturizeRush@users.noreply.github.com> Date: Fri, 15 May 2026 07:58:17 +0800 Subject: [PATCH] fix: add parentheses to fix operator precedence in co-author check (#1199) `??` has lower precedence than `!==`, so the expression: triggerDisplayName ?? triggerUsername !== "Unknown" parses as: triggerDisplayName ?? (triggerUsername !== "Unknown") When triggerDisplayName is an empty string "", the condition evaluates to "" (falsy), incorrectly skipping the co-author line even though the user is not "Unknown". Add parentheses to get the intended behavior: (triggerDisplayName ?? triggerUsername) !== "Unknown" Co-authored-by: Rush --- src/create-prompt/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/create-prompt/index.ts b/src/create-prompt/index.ts index 38144ce3..8fbe3abc 100644 --- a/src/create-prompt/index.ts +++ b/src/create-prompt/index.ts @@ -395,7 +395,7 @@ function getCommitInstructions( useCommitSigning: boolean, ): string { const coAuthorLine = - (githubData.triggerDisplayName ?? context.triggerUsername !== "Unknown") + ((githubData.triggerDisplayName ?? context.triggerUsername) !== "Unknown") ? `Co-authored-by: ${githubData.triggerDisplayName ?? context.triggerUsername} <${context.triggerUsername}@users.noreply.github.com>` : "";