Skip to content

Escaping double quotes #476

Description

@ohshazbot

I include the last commit message in my messaging, which works great until I recently did a revert and discovered that commit messages with double quotes break the action.

      - name: Deploy Complete Success Notification
        uses: slackapi/slack-github-action@v2.1.0
        if: success()
        env:
          MESSAGE: "${{ github.event.workflow_run.head_commit.message || github.event.head_commit.message }}"
        with:
          method: chat.postMessage
          token: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
          payload: |
            channel: monitoring
            text: "FRONTEND: Deployment of '${{ env.MESSAGE }}' to ${{ github.ref_name }} Completed"

I've tried wrapping env.MESSAGE in toJSON (as mentioned as a solution in #202), but that does not address the issue with double quotes it seems. I'm also not seeing any suggestions for how to overcome in https://tools.slack.dev/slack-github-action/sending-variables. What is the proper way to get this working correctly?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentationquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions