diff --git a/entrypoint.sh b/entrypoint.sh index f867cf9..eb3bf93 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,8 @@ set -e git fetch --tags -git fetch --prune --unshallow +# This suppress an error occurred when the repository is a complete one. +git fetch --prune --unshallow || true latest_tag='' @@ -13,7 +14,7 @@ if [ "${INPUT_SEMVER_ONLY}" = 'false' ]; then else # Get a latest tag in the shape of semver. for ref in $(git for-each-ref --sort=-creatordate --format '%(refname)' refs/tags); do - tag="${ref#refs/tags/}" + readonly tag="${ref#refs/tags/}" if echo "${tag}" | grep -Eq '^v?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$'; then latest_tag="${tag}" break