fix(ci): detect a missing nightly tag

This commit is contained in:
Michel de Graaf
2026-09-08 14:29:01 +02:00
parent 2975438949
commit 922ad6fc35
+4 -5
View File
@@ -168,13 +168,12 @@ jobs:
gh release edit nightly --draft --prerelease --latest=false gh release edit nightly --draft --prerelease --latest=false
fi fi
# The Git refs API can briefly lag a just-merged commit. Retry both # gh writes the REST error body to stdout on a missing ref, so use
# the create and update paths, re-reading the ref each time so a # its exit status—not captured output—to choose create vs update.
# successful-but-disconnected response is harmless and idempotent. # Retry both paths and re-read the ref to keep retries idempotent.
tag_ready=false tag_ready=false
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
current_tag=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/nightly" --jq .object.sha 2>/dev/null || true) if gh api --silent "repos/$GITHUB_REPOSITORY/git/ref/tags/nightly" >/dev/null 2>&1; then
if [ -n "$current_tag" ]; then
if gh api --silent --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/nightly" \ if gh api --silent --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/nightly" \
-f sha="$SOURCE_SHA" -F force=true; then -f sha="$SOURCE_SHA" -F force=true; then
tag_ready=true tag_ready=true