How do you write a step output, including a multiline value?
BeginnerConceptContexts, Expressions, Env & Outputs
Answer
Append to the $GITHUB_OUTPUT file. Multiline values use a heredoc-style delimiter, which should be random for untrusted content:
echo "tag=v1.4.0" >> "$GITHUB_OUTPUT"
delim="EOF_$(openssl rand -hex 8)"
{
echo "notes<<$delim"
git log --oneline v1.3.0..HEAD
echo "$delim"
} >> "$GITHUB_OUTPUT"
Read as steps.<id>.outputs.notes. The step needs an id.
More on Contexts, Expressions, Env & Outputs
List the available contexts and what each holds.BeginnerWhich contexts can you use in which keys? Give two examples that trip people up.AdvancedWhat are the expression operators and how do comparisons coerce types?IntermediateHow do you write a ternary in GitHub Actions expressions?IntermediateWhat do `contains`, `startsWith`, `endsWith`, `format` and `join` do?BeginnerWhat are object filters (`.*`) and how are they useful?Intermediate