Skip to content

Commit 10aef94

Browse files
committed
use jq to sanitize release body, remove What's Changed header
1 parent c25bcdf commit 10aef94

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

ansible/roles/repository/templates/Jenkinsfile.j2

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ pipeline {
13151315
echo "Auto-generating release notes"
13161316
sh '''AUTO_RELEASE_NOTES=$(curl -fsL -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/generate-notes \
13171317
-d '{"tag_name":"'${META_TAG}'",\
1318-
"target_commitish": "{{ ls_branch }}"}' | jq -r '.body') '''
1318+
"target_commitish": "{{ ls_branch }}"}' | jq -r '.body' | sed 's|## What.s Changed||') '''
13191319
echo "Pushing New tag for current commit ${META_TAG}"
13201320
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \
13211321
-d '{"tag":"'${META_TAG}'",\
@@ -1351,12 +1351,20 @@ pipeline {
13511351
{% elif external_type == "pip_version" %}
13521352
echo "Updating PIP version of ${EXT_PIP} to ${EXT_RELEASE_CLEAN}" > releasebody.json
13531353
{% elif external_type == "custom" %} echo "Custom External Release" > releasebody.json{% endif %}
1354-
echo '{"tag_name":"'${META_TAG}'",\
1355-
"target_commitish": "{{ ls_branch }}",\
1356-
"name": "'${META_TAG}'",\
1357-
"body": "**CI Report:**\\n\\n'${CI_URL:-N/A}'\\n\\n**LinuxServer Changes:**\\n\\n'${AUTO_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
1358-
printf '","draft": false,"prerelease": {% if release_type == "stable" %}false{% elif release_type == "prerelease" %}true{% endif %}}' >> releasebody.json
1359-
paste -d'\\0' start releasebody.json > releasebody.json.done
1354+
jq -n \
1355+
--arg tag_name "$META_TAG" \
1356+
--arg target_commitish "{{ ls_branch }}" \
1357+
--arg ci_url "${CI_URL:-N/A}" \
1358+
--arg ls_notes "$AUTO_RELEASE_NOTES" \
1359+
--arg remote_notes "$(cat releasebody.json)" \
1360+
'{
1361+
"tag_name": $tag_name,
1362+
"target_commitish": $target_commitish,
1363+
"name": $tag_name,
1364+
"body": ("**CI Report:**\\n\\n" + $ci_url + "\\n\\n**LinuxServer Changes:**\\n\\n" + $ls_notes + "\\n\\n**Remote Changes:**\\n\\n" + $remote_notes),
1365+
"draft": false,
1366+
"prerelease": {% if release_type == "stable" %}false{% elif release_type == "prerelease" %}true{% endif %}
1367+
}' > releasebody.json.done
13601368
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
13611369
}
13621370
}

0 commit comments

Comments
 (0)