Skip to content

Commit d49455c

Browse files
committed
If no variable is provided, default to the last tag
1 parent a1cb7ac commit d49455c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ _findGithubToken() {
7070
}
7171

7272
_findGitHeads() {
73+
local last_tag=$(git tag --sort=-creatordate | head -1)
7374
GIT_TAG=${2:-HEAD}
74-
GIT_START_REF=${1:-HEAD}
75+
GIT_START_REF=${1:-$last_tag}
7576

7677
# Check if $GIT_START_REF exists
7778
if ! git rev-parse --quiet --verify $GIT_START_REF > /dev/null; then
78-
_error $GIT_START_REF branch not found. Make sure you have the branch locally.
79+
_error $GIT_START_REF not found. Make sure you have the refname is reachable.
7980
fi
8081
}
8182

@@ -98,5 +99,6 @@ USAGE
9899

99100
case $1 in
100101
h|help|--help) _usage; grep -A100 OPTIONS $0;;
102+
l|list|--list) git tag --sort=-creatordate ;;
101103
*) main $@ ;;
102104
esac

0 commit comments

Comments
 (0)