X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tools%2Fgeneratechangelog-pipeline.sh;h=e2fa55e4557b6a147a8c28d733d66deff1284a3b;hb=6264e9b24bbe0714f556d1696e7cb6ccb53e5f35;hp=c527c54993d72316bed4b8d43c070bb6f465dfcb;hpb=9054244cd2a7451f75157d7fa3ec5d2ff88176be;p=osm%2Fdevops.git diff --git a/tools/generatechangelog-pipeline.sh b/tools/generatechangelog-pipeline.sh index c527c549..e2fa55e4 100755 --- a/tools/generatechangelog-pipeline.sh +++ b/tools/generatechangelog-pipeline.sh @@ -2,8 +2,17 @@ REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1) # get the latest tag -TAG_END="HEAD" TAG_START=$(git tag | sort -Vr | head -1) + +head_tag_diff=$(git rev-list $TAG_START ^HEAD |wc -l) +if [ $head_tag_diff -eq 0 ]; then + # HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff + TAG_END=$TAG_START + TAG_START=$(git tag | sort -Vr | head -2 | sort -V | head -1) +else + TAG_END="HEAD" +fi + git pull --tags origin master &> /dev/null echo "

$REPO_NAME Changelog

" echo "

tag: ${TAG_START} -> ${TAG_END}

"