YAML folded multiline strings interpreted as multiple commands #26105
-
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. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Thanks for reporting this, we’re taking a look. |
Beta Was this translation helpful? Give feedback.
-
Could you give an example of where you are using the folding syntax? |
Beta Was this translation helpful? Give feedback.
-
I’ve made a branch in reproc that changes one of my CMake invocations to use a folded multiline string on Ubuntu and macOS: https://github.com/DaanDeMeyer/reproc/runs/217390896 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). |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
@daandemeyer could you try formatting your command like this and see if you still see the issue
I think the extra level of indent is informing the YAML parser to add additional new line characters. |
Beta Was this translation helpful? Give feedback.
-
To elaborate on the syntax here a bit more, this is one of the odder parts of the YAML specification:
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 😂 |
Beta Was this translation helpful? Give feedback.
-
That fixes the issue. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I agree, this doesn’t exactly seem intuitive for a config language. Hopefully this thread helps others that encounter the same issue. |
Beta Was this translation helpful? Give feedback.
@daandemeyer could you try formatting your command like this and see if you still see the issue
I think the extra level of indent is informing the YAML parser to add additional new line characters.