I am running the following code, but if env.body
contains $
, it will be translated as a variable.
printf -v markdown_message_unescaped %b "<${{ env.URL }}|*${{ env.body }}*>\n"
jq -n -r --arg text "$markdown_message_unescaped" '{"text": $text}'|curl -X POST -H 'Authorization: Bearer ${{ secrets.TOKEN }}' -H "Content-Type: application/json" -d @- ${{ env.URL }}
I modified the code to look like the following to escape $
, but this does not work well if single quotes are included in env.body
.
body='${{ env.body }}'
printf -v markdown_message_unescaped %b "<${{ env.URL }}|*$body*>\n"
jq -n -r --arg text "$markdown_message_unescaped" '{"text": $text}'|curl -X POST -H 'Authorization: Bearer ${{ secrets.TOKEN }}' -H "Content-Type: application/json" -d @- ${{ env.URL }}
Is there a way to fix this?