Multiline curl post json data get broken

I am trying to auto upgrade npm package in a repo using github api. All steps in drone command works fine. Only at the end I need to update package.json using CURL post with JSON data. To use variable in the JSON data I had to use multiline using cat <<EOF. But every time github api returns “Problems parsing JSON” because of content property which suppose to contain base64 data. From below you can see I stored base64 data in $content variable first then use it in JSON. After some debugging found that if I use base64 data straight in JSON without assigning it to content it works. Is it some bug? Is there a workaround to make it work? Thanks. --- pipeline: auto-upgrade-npm-package-version: image: docker.artifactory.org.com/everpeace/curl-jq:latest secrets: [ GITHUB_TOKEN ] environment: - NEW_TAG=2.5.5 - OLD_TAG=2.5.0 - BRANCH=feature/xyz - SHA=11c357c5b07f114fcfd70ad469bfae4606ab3909 commands: - content=(curl -s -H “Content-Type:application/json” github/raw/ORG/Repo/feature/xyz/package.json | jq ‘.dependencies.package = 2.5.5’ | base64)
- |
curl -v --show-error -X PUT -H “Content-Type:application/json” -H “Authorization:token GITHUB_TOKEN" -d "(cat <<EOF
{
“message”: “[BOT] Package version upgrade to $NEW_TAG from $OLD_TAG”,
“committer”: {
“name”: “BOT”,
“email”: “[email protected]
},
“branch”: “$BRANCH”,
“content”: “$content”, <- this $content with base64 data breaks the json
“sha”: “$SHA”
}
EOF
)” github/api/v3/repos/ORG/Repo/contents/package.json?ref=$BRANCH