GitHub Actions multiline GITHUB_OUTPUT broken without heredoc
By Kaveh Alemi·Latchkey
Like GITHUB_ENV, the GITHUB_OUTPUT file needs a heredoc for multiline values. Writing key=value with embedded newlines truncates the output at the first newline or corrupts the file.
What this error means
A downstream steps.<id>.outputs.* reference contains only the first line, or the step fails parsing the output file.
github-actions
# Only the first line is captured without a heredoc:
echo "json=$(cat data.json)" >> "${GITHUB_OUTPUT}"
Common causes
Multiline value without heredoc
Embedded newlines break the key=value line format of the output file.
Unescaped content in the value
Content resembling the file format can corrupt parsing.
How to fix it
Write multiline outputs with a heredoc
Use KEY<<EOF ... EOF redirected to \${GITHUB_OUTPUT}.