From a149281d9246c359f3fbbe05b1773cfab397330e Mon Sep 17 00:00:00 2001 From: Finesssee Date: Sun, 16 Aug 2026 05:24:37 +0700 Subject: [PATCH] fix(publish): verify release by id after upload, not by tag Get-Release queries releases/tags/{tag} which can 404 transiently right after gh release upload due to GitHub API eventual consistency. The post-upload check (line 267) then saw $null and threw 'Release disappeared or is no longer draft', failing publish after the first asset uploaded successfully. Add Get-ReleaseById (repos/{repo}/releases/{id}) and use it for the post-upload verification. The release id is already known from the in-progress $release object, so by-id is deterministic and avoids the transient by-tag 404. --- scripts/publish-github-release.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/publish-github-release.ps1 b/scripts/publish-github-release.ps1 index 5c61367afa..6d30416788 100644 --- a/scripts/publish-github-release.ps1 +++ b/scripts/publish-github-release.ps1 @@ -98,6 +98,12 @@ function Get-Release { } } +function Get-ReleaseById { + param([Parameter(Mandatory)][string]$Id) + + return Invoke-GhJson @('api', "repos/$Repository/releases/$Id") +} + function New-DraftRelease { return Invoke-GhJson @( 'api', '--method', 'POST', "repos/$Repository/releases", @@ -264,7 +270,7 @@ foreach ($path in $assetPaths) { } throw } - $release = Get-Release + $release = Get-ReleaseById ([string]$release.id) if (-not $release -or -not [bool]$release.draft) { throw "Release $Tag disappeared or is no longer draft after uploading $name." }