Skip to content

Fix tag available check to refuse prefix matching#82

Merged
wagoodman merged 1 commit intomainfrom
fix-check-version-available
May 4, 2026
Merged

Fix tag available check to refuse prefix matching#82
wagoodman merged 1 commit intomainfrom
fix-check-version-available

Conversation

@wagoodman
Copy link
Copy Markdown
Contributor

Switched the tag-existence check from git/refs/tags/{name} (prefix match,
returns an array) to git/ref/tags/{name} (exact match, returns 404 when
absent). The previous form treated any 200 as "tag exists", producing a
false positive whenever a related pre-release tag was already pushed.

For example, with tags v0.1.0-rc1, v0.1.0-rc2, v0.1.0-rc3 present and v0.1.0 not:

$ gh api "repos/OWNER/REPO/git/refs/tags/v0.1.0" -i | head -1
HTTP/2.0 200 OK    # matches the rc tags by prefix — wrong

$ gh api "repos/OWNER/REPO/git/ref/tags/v0.1.0" -i | head -1
HTTP/2.0 404 Not Found    # correct

Additional fixes:

  • ${{ github.repository }} moved into env: as REPO.
  • ${HTTP_STATUS:-000} replaces a || echo "000" that was bound to awk
    and never fired on gh api failure.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman added the bug Something isn't working label May 4, 2026
@wagoodman wagoodman merged commit 8b2b1ca into main May 4, 2026
4 checks passed
@wagoodman wagoodman deleted the fix-check-version-available branch May 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant