Skip to content

Commit 64cfb69

Browse files
Improve tag existence check robustness with literal string matching
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 9001cd7 commit 64cfb69

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/manual-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)