小编Kin*_*man的帖子

Github api 不解析多行 shell 变量

我在 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)

shell json github-api

3
推荐指数
1
解决办法
642
查看次数

标签 统计

github-api ×1

json ×1

shell ×1