Skip to content

Commit a9386a7

Browse files
committed
detect no new commits when generating release notes
1 parent 10aef94 commit a9386a7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ansible/roles/repository/templates/Jenkinsfile.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,9 +1313,15 @@ pipeline {
13131313
}
13141314
steps {
13151315
echo "Auto-generating release notes"
1316-
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 \
1317-
-d '{"tag_name":"'${META_TAG}'",\
1318-
"target_commitish": "{{ ls_branch }}"}' | jq -r '.body' | sed 's|## What.s Changed||') '''
1316+
sh '''if [ "$(git tag --points-at HEAD)" != "" ]; then
1317+
echo "Existing tag points to current commit, suggesting no new LS changes"
1318+
AUTO_RELEASE_NOTES="No changes"
1319+
else
1320+
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 \
1321+
-d '{"tag_name":"'${META_TAG}'",\
1322+
"target_commitish": "{{ ls_branch }}"}' \
1323+
| jq -r '.body' | sed 's|## What.s Changed||')
1324+
fi'''
13191325
echo "Pushing New tag for current commit ${META_TAG}"
13201326
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \
13211327
-d '{"tag":"'${META_TAG}'",\

0 commit comments

Comments
 (0)