我在 jenkins 配置中有一个文本参数(来自 jenkins job dsl 插件),它允许您输入多行注释。从 shell 脚本向 github 存储库发布版本时,我使用该变量作为主体值。我收到这个错误,说解析 json 有问题,我找不到解决方法。我会在下面给你举个例子。请帮忙。
PERSONAL_ACCESS_TOKEN="random"
TAG_NAME="12.0.0"
VERSION_BUMP="major"
MIGRATION_DOCUMENT="This is first line
This is second line"
curl -i \
-H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" \
-d '{"tag_name": "'"${TAG_NAME}"'", "name": "'"${VERSION_BUMP}"'", \
"body": "'"${MIGRATION_DOCUMENT}"'"}' \
https://github.deere.com/api/v3/repos/randomOrg/testRepo/releases
Run Code Online (Sandbox Code Playgroud)