Hello I'm sending the commit message to a webhook triggerin a notification with curl during my GitHub action.
curl -H 'Content-Type:application/json' -d '{ "commit":"${{github.event.head_commit.message}}",...}'
It isn't working with commit's messages including ", example if the commit's message is: feat(#7): replace "FAQ" by "Help Center"
The GitHub Action will try to execute curl this way:
curl -H 'Content-Type:application/json' -d '{ "commit":"feat(#7): replace "FAQ" by "Help Center"",...}'
Resulting in errors...
I tried to escape the double quotes with this code:
- run: echo "GITHUB_COMMIT=$(echo ${{github.event.head_commit.message}} | sed 's/"/\\"/g')" >> $GITHUB_ENV
But again the Github Action is replacing the value "literally" in my deploy.yml during execution:
Run echo "GITHUB_COMMIT=$(echo feat(#7): replace "FAQ" by "Help Center" | sed 's/"/\\"/g')" >> $GITHUB_ENV
/home/runner/work/_temp/1e27e232-c415-42e0-8ab8-88bb836a0c08.sh: line 1: unexpected EOF while looking for matching `)'
Error: Process completed with exit code 2.
Is there any way to perform operations on the GitHub action context properties? (Like a replace here) ?