github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Can't execute multiline commands

Open phanan opened this issue 4 years ago • 2 comments

With GitHub actions, one can execute multiple commands with this multiline syntax:

run: |
  command1 --option1
  command2 --option2

Such behavior, however, doesn't seem to be respected by Cypress GH action. For instance, if I have this setup:

- uses: cypress-io/github-action@v2
  with:
    build: |
      command1 --option1
      command2 --option2

The actual command executed will be a combined, invalid, command1 --option1 command2 --option2.

phanan avatar Jan 04 '21 08:01 phanan

I ran into a similar problem with the build parameter.

It's caused by the execCommand() function here. I don't understand why but the Cypress action doesn't just pass the string as-is to the shell, it parses the build string using argument-vector (which basically just splits it on whitespace), checks that the first segment of the string (in your example command) resolves to a known binary on the $PATH using which and then glues the string components back together (which is why your command ends up as one long string).

In my case my build failed using build: ./bin/build because which ./bin/build fails 🙄

wmadden avatar Jan 13 '21 11:01 wmadden

I would be open to a pull request implementing this

bahmutov avatar Feb 04 '21 17:02 bahmutov