slackapi / slackapi/slack-github-action
Escaping double quotes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 200
- Avg merge
- 2h 59m
- Merged PRs (30d)
- 6
Description
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 https://github.com/slackapi/slack-github-action/issues/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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the workflow with a commit message containing double quotes, then review the workaround discussed in issue 202 and the sending-variables documentation linked in the report. The issue is resolved when the deployment notification posts the complete commit message without breaking the action payload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, yaml
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100