mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-07-27 22:38:30 +08:00
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 <rush@RushdeMacBook-Pro.local>
This commit is contained in:
parent
51ea8ea73a
commit
bbad5183ff
@ -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>`
|
||||
: "";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user