detect no new commits when generating release notes

This commit is contained in:
aptalca 2025-09-10 15:55:37 -04:00
parent 10aef94a2f
commit a9386a7d16
No known key found for this signature in database
GPG Key ID: BE36CFFB9FD85548

View File

@ -1313,9 +1313,15 @@ pipeline {
}
steps {
echo "Auto-generating release notes"
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 \
-d '{"tag_name":"'${META_TAG}'",\
"target_commitish": "{{ ls_branch }}"}' | jq -r '.body' | sed 's|## What.s Changed||') '''
sh '''if [ "$(git tag --points-at HEAD)" != "" ]; then
echo "Existing tag points to current commit, suggesting no new LS changes"
AUTO_RELEASE_NOTES="No changes"
else
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 \
-d '{"tag_name":"'${META_TAG}'",\
"target_commitish": "{{ ls_branch }}"}' \
| jq -r '.body' | sed 's|## What.s Changed||')
fi'''
echo "Pushing New tag for current commit ${META_TAG}"
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \
-d '{"tag":"'${META_TAG}'",\