From 085f6b0accf2c3176ced954f0ef82c67a7a62542 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 20 Oct 2026 10:36:33 -0700 Subject: [PATCH] Handle missing release tags correctly GitHub returns an error body when a tag does not exist. Treating that body as a commit SHA prevents the publisher from creating new release tags. --- tools/pipelines/typescript-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/pipelines/typescript-publish.yml b/tools/pipelines/typescript-publish.yml index 92a035cc3d927..59086f0c433af 100755 --- a/tools/pipelines/typescript-publish.yml +++ b/tools/pipelines/typescript-publish.yml @@ -370,7 +370,8 @@ extends: ;; esac - existingTagCommit="$(gh api "repos/microsoft/TypeScript/git/ref/tags/$tag" --jq '.object.sha' 2>/dev/null || true)" + existingTagCommit="$(gh api "repos/microsoft/TypeScript/git/matching-refs/tags/$tag" \ + --jq ".[] | select(.ref == \"refs/tags/$tag\") | .object.sha")" if [ -n "$existingTagCommit" ]; then if [ "$existingTagCommit" != "$RELEASE_SOURCE_COMMIT" ]; then echo "Tag $tag points to $existingTagCommit, expected $RELEASE_SOURCE_COMMIT." >&2