Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Newline not interpreted by args? #97

Open
melchoir55 opened this issue Oct 30, 2020 · 2 comments
Open

Newline not interpreted by args? #97

melchoir55 opened this issue Oct 30, 2020 · 2 comments

Comments

@melchoir55
Copy link

We're having a weird issue where env vars are interpolating but we can't seem to get a newline character to work. We've tried both single and double character escapes:

      - name: Slack notification
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        uses: Ilshidur/action-slack@2.0.2
        with:
          args: 'A merge to `App.dev` has occurred successfully. \\n
          Commit ID: {{GITHUB_SHA}} \\n'
      - name: Slack notification
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
        uses: Ilshidur/action-slack@2.0.2
        with:
          args: 'A merge to `App.dev` has occurred successfully. \n
          Commit ID: {{GITHUB_SHA}} \n'

For some reason the \n or \\n just show up directly in the message without being interpreted. Could you please offer some guidance here?
Also great job on the rest of your documentation. Very easy to understand.

@melchoir55
Copy link
Author

We got this working by changing the single quote to double quote on the string parameter passed to args. I think it would be worth updating your docs with this bit.

@itsmelion
Copy link
Collaborator

Use double quotes. ☺️
here is the args for my beloved bot Illidan Stormrage:

with:
  args: "*BUILD failed*\n_You are not prepared._"

It's needed to investigate further ahead why it's necessary, and how far that 'real' line break you added after the \n is maybe affecting anything.
and maybe a PR tweak it so people also don't fall in this pit.

a guess is maybe the double quote tells the YAML parser interpolate that line..
(like in the command line behaviour, e.g: echo 'I am $USER' versus: echo "I am $USER")

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

No branches or pull requests

2 participants