Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some multiline commands only run with the first line #14

Closed
capnspacehook opened this issue Aug 19, 2023 · 3 comments
Closed

Some multiline commands only run with the first line #14

capnspacehook opened this issue Aug 19, 2023 · 3 comments

Comments

@capnspacehook
Copy link

capnspacehook commented Aug 19, 2023

Here's a simple example of what triggers this behavior:

- uses: gacts/run-and-post-run@v1
  with:
    run: |
      if [[ true == true ]]; then
        echo "true"
      else
        echo "false"
      fi
    post: |
      if [[ true == true ]]; then
        echo "true"
      else
        echo "false"
      fi

The output:

image

I suspect it's due to a bug in joinMultilineCommands, but I know next to no Javascript/Typescript so I can't easily fix it myself.

Edit: after looking at the code a bit more closely, it seems the problem is because commands are always split into separate lines and run one line at a time. I think this makes sense when shell and/or post-shell is set to "" (invoking commands directly) and the user provided a list of commands. However is the shell is set, I think the input commands should not be modified and instead executed by the set shell as-is. Does that sound reasonable to you?

@tarampampam
Copy link
Collaborator

Could you try this?

4,7c4,7
<       if [[ true == true ]]; then
<         echo "true"
<       else
<         echo "false"
---
>       if [[ true == true ]]; then \
>         echo "true" \
>       else \
>         echo "false" \
10,13c10,13
<       if [[ true == true ]]; then
<         echo "true"
<       else
<         echo "false"
---
>       if [[ true == true ]]; then \
>         echo "true" \
>       else \
>         echo "false" \

@tarampampam
Copy link
Collaborator

Ping @capnspacehook

@tarampampam
Copy link
Collaborator

Closed due inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants