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

Escape Quotes in fields #21

Open dkershner6 opened 2 years ago

dkershner6 commented 2 years ago

The action breaks without having JSON unfriendly characters escaped, and GitHub actions doesn't have a way to do this to the input (but C# does!).

Can the inputs please be escaped before sending?

maikschneider commented 1 year ago

Yes, this is a really annoying issue. Are there any plans to fix this?

maikschneider commented 1 year ago

Ah, there was a simple solution: Just escape the input via toJSON() function. The returned value is in quotes, so you need to remove them in the schema, e.g.:

    steps:
      - uses: aliencube/microsoft-teams-actions@v0.8.0
        with:
          title: 'New comment on issue #${{ github.event.issue.number }}: "${{ github.event.issue.title }}"'
          sections: '[{ "activityText": ${{ toJSON(github.event.comment.body) }}  }]'