fix(cli): terminate each GITHUB_ENV/GITHUB_OUTPUT entry with a trailing newline#4059
Conversation
.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 triggerdotdev#4003
|
|
Hi @codewithsupra, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe change updates ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
setGithubActionsOutputAndEnvVarsinpackages/cli-v3/src/utilities/githubActions.tsbuilds entries with.map(...).join('\n')— which separates entries but leaves the last entry without a trailing newline.Both
$GITHUB_ENVand$GITHUB_OUTPUTare job-scoped append files. Without a trailing newline, the last written entry (needsPromotion=...) is left on an unterminated line. Any subsequent write by the runner or another step can concatenate onto it, producing merged/malformed values likeneedsPromotion=trueSOME_OTHER_KEY=value— breaking promotion branching. The bug is intermittent because GitHub Actions sometimes inserts its own newline.Fix
Match the
@actions/coreconvention — every entry gets its own trailing\n:Applied to both the
GITHUB_ENVandGITHUB_OUTPUTwrites.Fixes #4003