Amadevus/pwsh-script

Failing Set-ActionOutput when value is multi-line

amis92 opened this issue · 2 comments

Setting output fails when using environment files and passing a multi-line value.

image

https://github.com/Amadevus/pwsh-script/actions/runs/3276636531/jobs/5392922719#step:11:13

Error: Unable to process file command 'output' successfully.
Error: Invalid format ' new line '

Turns out, the implementation incorrectly decides to use key=value format. When newline in value is detected, it should instead use the key<<delimiterLFvalueLFdelimiter format.

However, the PowerShell implementation of ConvertTo-ActionKeyValueFileCommand makes an incorrect comparison to find whether value has newlines: ($convertedValue -contains "n")will return true only if value *is* a single newline, because-contains` is a collection operator, not a string operator.

Bug is in version 2.0.2 of this action.