aliencube / microsoft-teams-actions

This is a GitHub Actions that sends a message to a given channel in Microsoft Teams
MIT License
79 stars 23 forks source link

Respect newlines in text input #26

Open vsayer opened 6 months ago

vsayer commented 6 months ago

At the current moment, it doesn't appear newlines are being respected when sending the alert to teams. We're preparing a changelog which is then being passed into the text input. If the changelog is multiline, text: parses it as single-line, i.e.,

Here's what I see:

A new version was just published: v1.4.1 🚀 Changelog: \n### Blah\n\n- blah: blah\n- blah: blah\n\n### Fixes\n ... \n

Tried escaping newlines in a previous step but no luck either.

notification_changelog="$(echo "$changelog" | sed -z 's/\n/\\n/g')"

Here's how I'm using the action:

      - name: Announce release on msteams
        uses: aliencube/microsoft-teams-actions@v0.8.0
        with:
          webhook_uri: ${{ secrets.MSTEAMS_WEBHOOK_RELEASES_URL }}
          title: 'A new version was just published: ${{ steps.tag_version.outputs.new_tag }}
            🚀'
          summary: 'A new version was just published: ${{ steps.tag_version.outputs.new_tag }}
            🚀'
          text: |
            Changelog:
              ${{ steps.prepare_notification_changelog.outputs.notification_changelog }}

Any help appreciated!