YAML folded multiline strings interpreted as multiple commands

When using YAML folded multiline strings (using ‘>’ instead of ‘|’), each line is still interpreted as a separate command instead of the newlines just being replaced by spaces.

See https://yaml-multiline.info/ for more information on YAML folded multiline strings.


Thanks for reporting this, we’re taking a look.

Could you give an example of where you are using the folding syntax?

I’ve made a branch in reproc that changes one of my CMake invocations to use a folded multiline string on Ubuntu and macOS:


I want to use folding to avoid the platform specific command continuation character (’’ on Linux/macOS bash, ‘^’ on Windows cmd). Using folding, all newlines get converted to spaces which removes the need for the platform specific continuation character.

Unfortunately, we can see that all Ubuntu and macOS builds fail in the Configure step due to folded multiline strings being interpreted as multiple commands (at least that seems to be what’s going on).

Currently the run step just takes the multi-line contents and writes that to a file that is then executed using the specified shell program.  The parser does not make any decisions based on the particular type of multi-line specifier in the YAML.  

Unfortunately I think we may have an issue where changing that behavior now will potentially cause workflow files that are currently working to break.

I realize that a Beta is not supposed to break stuff but it would be rather convenient if this could still be changed while Github Actions is still in Beta.

Of course, your team has a way better view on how much stuff is already depending on this behavior than me so I understand if it’s not possible to change this anymore.

@daandemeyer could you try formatting your command like this and see if you still see the issue

- run: >-
    -B build
    -S .
    -G Ninja

I think the extra level of indent is informing the YAML parser to add additional new line characters.


To elaborate on the syntax here a bit more, this is one of the odder parts of the YAML specification:

[scalar content] can be written with the folded style (denoted by “>”) where each line break is folded to a space unless it ends an empty or a more-indented line.


It’s on yaml-multiline.info, too, but to be honest I’ve never actually read the paragraph on that page where it happens to mention this :joy:

1 Like

That fixes the issue. Thanks!

I agree, this doesn’t exactly seem intuitive for a config language. Hopefully this thread helps others that encounter the same issue.