Skip to content

Commit 5d4aaf5

Browse files
authored
๐Ÿ› ci: detect floating tags via exact ref endpoint (#30)
The floating-tag workflow added in #29 moved `v1` correctly but failed to create `v1.0`, exiting with HTTP 422. ๐Ÿ› The existence check queried `git/refs/tags/<ref>`, the plural list endpoint, which prefix-matches: `tags/v1.0` matched the existing `v1.0.x` releases, so the script believed `v1.0` already existed and tried to `PATCH` a ref that was never there. Switching the check to the singular `git/ref/tags/<ref>` endpoint makes it exact: an absent floating tag returns 404, so the script falls through to creating it. `v1` already points at `v1.0.4` from the first dispatch; re-running after this merge will create the missing `v1.0`.
1 parent 216fdb1 commit 5d4aaf5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

โ€Ž.github/workflows/release.ymlโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
minor="v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
3535
sha="$(gh api "repos/${REPO}/commits/${TAG}" --jq '.sha')"
3636
for ref in "${major}" "${minor}"; do
37-
if gh api "repos/${REPO}/git/refs/tags/${ref}" >/dev/null 2>&1; then
37+
if gh api "repos/${REPO}/git/ref/tags/${ref}" >/dev/null 2>&1; then
3838
gh api -X PATCH "repos/${REPO}/git/refs/tags/${ref}" -f "sha=${sha}" -F force=true >/dev/null
3939
else
4040
gh api -X POST "repos/${REPO}/git/refs" -f "ref=refs/tags/${ref}" -f "sha=${sha}" >/dev/null

0 commit comments

Comments
ย (0)