Tag Archives: dash

YAML pipe dash what?

I was looking at some GitHub actions and noticed a literal, pipe |, with a dash, -, and had no idea what it meant. After a bit of searching, I found YAML Multiline which showed the effects of the feature when making multi-line strings. I.e.
run: |-
vs
run: |

The dash is the block chomping indicator which lets yaml know if it should keep the newline at the end of the multi-line string. If you chomp it strips the new line. If you just use the pipe, it’ll contain the last new line.

Now does it really matter in GitHub actions? I don’t really think so. Most shells will strip the last newline character of a command.

So there you go. Pipe dash strips the last end line character of the multiline lateral command.