diff --git a/scripts/create_release_notes.sh b/scripts/create_release_notes.sh index 93b662dc..889d0af7 100755 --- a/scripts/create_release_notes.sh +++ b/scripts/create_release_notes.sh @@ -1,9 +1,19 @@ #!/bin/bash -current_tag=$(git describe --abbrev=0 --tags HEAD) -previous_tag_hash=$(git rev-list --tags --skip=1 --max-count=1) +function is_head_tagged() { + git describe --exact-match --tags HEAD 2>/dev/null +} + +if is_head_tagged; then + current_tag=$(git describe --abbrev=0 --tags HEAD) + previous_tag_hash=$(git rev-list --tags --skip=1 --max-count=1) +else + previous_tag_hash=$(git rev-list --tags --max-count=1) +fi + previous_tag=$(git describe --abbrev=0 --tags $previous_tag_hash) + range="$previous_tag..HEAD" commits_since_previous_tag=$(git log --no-merges --pretty=format:"* %s" $range)