File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,15 +127,15 @@ jobs:
127127
128128 echo "Checking if tag $TAG_NAME already exists..."
129129
130- # Check if tag exists locally
131- if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
130+ # Check if tag exists locally (use show-ref to check specifically for tags)
131+ if git show-ref --tags "$TAG_NAME" >/dev/null 2>&1; then
132132 echo "::error::Tag $TAG_NAME already exists in the repository."
133133 echo "Please use a different version number or delete the existing tag first."
134134 exit 1
135135 fi
136136
137- # Check if tag exists on remote (use exact matching to avoid false positives )
138- if git ls-remote --tags origin "$TAG_NAME" | grep -q "refs/tags/$TAG_NAME$ "; then
137+ # Check if tag exists on remote (use grep -F for literal string matching )
138+ if git ls-remote --tags origin "$TAG_NAME" | grep -qF "refs/tags/$TAG_NAME"; then
139139 echo "::error::Tag $TAG_NAME already exists on remote."
140140 echo "Please use a different version number or delete the existing tag first."
141141 exit 1
You can’t perform that action at this time.
0 commit comments