From 03c2c25036ccb57e360215f41dfa670fb092c54b Mon Sep 17 00:00:00 2001 From: ANSHSINGH050404 <114014895+ANSHSINGH050404@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:22:29 +0530 Subject: [PATCH] fix(cli): terminate GITHUB_ENV/GITHUB_OUTPUT entries with trailing newline Closes #4003 --- .changeset/github-actions-trailing-newline.md | 5 +++++ packages/cli-v3/src/utilities/githubActions.ts | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .changeset/github-actions-trailing-newline.md diff --git a/.changeset/github-actions-trailing-newline.md b/.changeset/github-actions-trailing-newline.md new file mode 100644 index 00000000000..52c81f52422 --- /dev/null +++ b/.changeset/github-actions-trailing-newline.md @@ -0,0 +1,5 @@ +--- +"trigger.dev": patch +--- + +Terminate each GITHUB_ENV and GITHUB_OUTPUT entry with a trailing newline so later appends cannot merge onto the last value. diff --git a/packages/cli-v3/src/utilities/githubActions.ts b/packages/cli-v3/src/utilities/githubActions.ts index a4a80e75a1e..9a5e4b34524 100644 --- a/packages/cli-v3/src/utilities/githubActions.ts +++ b/packages/cli-v3/src/utilities/githubActions.ts @@ -7,11 +7,12 @@ export function setGithubActionsOutputAndEnvVars({ envVars: Record; outputs: Record; }) { - // Set environment variables + // Set environment variables. Terminate each entry with a newline so a + // subsequent append cannot concatenate onto the last KEY=value line. 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 +20,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); }