From 922ad6fc35a7d8e0a42818f1fcf4adf6e387f802 Mon Sep 17 00:00:00 2001 From: Michel de Graaf Date: Tue, 8 Sep 2026 14:29:01 +0200 Subject: [PATCH] fix(ci): detect a missing nightly tag --- .github/workflows/nightly.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 065e350..005f468 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -168,13 +168,12 @@ jobs: gh release edit nightly --draft --prerelease --latest=false fi - # The Git refs API can briefly lag a just-merged commit. Retry both - # the create and update paths, re-reading the ref each time so a - # successful-but-disconnected response is harmless and idempotent. + # gh writes the REST error body to stdout on a missing ref, so use + # its exit status—not captured output—to choose create vs update. + # Retry both paths and re-read the ref to keep retries idempotent. tag_ready=false 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 [ -n "$current_tag" ]; then + if gh api --silent "repos/$GITHUB_REPOSITORY/git/ref/tags/nightly" >/dev/null 2>&1; then if gh api --silent --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/nightly" \ -f sha="$SOURCE_SHA" -F force=true; then tag_ready=true