From 9380b531164d394ff4dab3827ac3cc6e35af24a0 Mon Sep 17 00:00:00 2001 From: Supratim Sarkar Date: Fri, 26 Jun 2026 22:51:09 +0530 Subject: [PATCH] fix(cli): terminate each GITHUB_ENV/GITHUB_OUTPUT entry with a newline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .join('\n') only separates entries — it leaves the last KEY=value on an unterminated line. A subsequent write to the same runner-scoped file can merge onto that unterminated tail, corrupting the needsPromotion output and any other entries that follow. Match the @actions/core convention: each entry gets its own trailing newline. Switch from .map(...).join('\n') to .map(... + '\n').join('') so every line is properly terminated regardless of how many entries are written. Fixes #4003 --- packages/cli-v3/src/utilities/githubActions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli-v3/src/utilities/githubActions.ts b/packages/cli-v3/src/utilities/githubActions.ts index a4a80e75a1e..6022b791f62 100644 --- a/packages/cli-v3/src/utilities/githubActions.ts +++ b/packages/cli-v3/src/utilities/githubActions.ts @@ -10,8 +10,8 @@ export function setGithubActionsOutputAndEnvVars({ // Set environment variables if (process.env.GITHUB_ENV) { const contents = Object.entries(envVars) - .map(([key, value]) => `${key}=${value}`) - .join("\n"); + .map(([key, value]) => `${key}=${value}\n`) + .join(""); appendFileSync(process.env.GITHUB_ENV, contents); } @@ -19,8 +19,8 @@ export function setGithubActionsOutputAndEnvVars({ // Set outputs if (process.env.GITHUB_OUTPUT) { const contents = Object.entries(outputs) - .map(([key, value]) => `${key}=${value}`) - .join("\n"); + .map(([key, value]) => `${key}=${value}\n`) + .join(""); appendFileSync(process.env.GITHUB_OUTPUT, contents); }