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

Support multiline content message #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vinceglb
Copy link

@vinceglb vinceglb commented Oct 8, 2020

Hello !

Thanks for your GA, it is very useful in our workflow 👌

Problem

I found that it is not easy to write a multiline message with this plugin.

Exemple

- name: Discord notification
  env:
    DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
  uses: Ilshidur/action-discord@master
  with:
    args: 'Hello\nHow are you?'

Result with:
image

Solution

I added a new environment variable called DISCORD_MULTILINE (boolean).
When DISCORD_MULTILINE is set to 1 (true), we make sure that the \n will be replace with new lines 🎉

- name: Discord notification
  env:
    DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
    DISCORD_MULTILINE: 1
  uses: Ilshidur/action-discord@master
  with:
    args: 'Release notes:\n- 🚀 New features\n- ✨ Cool stuff'

image

What do you think?

@vinceglb
Copy link
Author

vinceglb commented Oct 8, 2020

You can try it with EBfVince/action-discord@master

- name: Discord notification
  env:
    DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
    DISCORD_MULTILINE: 1
  uses: EBfVince/action-discord@master
  with:
    args: 'Release notes:\n- 🚀 New features\n- ✨ Cool stuff'

@pilotkid
Copy link

@Ilshidur Any update on this? It works great.

@zaanposni
Copy link

I also stumbled upon this problem and found that using double quote " instead of single quotes ' in your workflow.yml also fixes this issue.
Maybe we should adjust the example in the readme so it is more intuitive.
My workflow.yml:

      - name: Send discord notification
        env:
          DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
        uses: Ilshidur/action-discord@master
        with:
          args: "🚀 bla bla.\n🚀 bla bla."

Which results in one message with multiple lines:
grafik

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

Successfully merging this pull request may close these issues.

3 participants