From bac155d8ecb045ed0ef6bac948f3542e164031c9 Mon Sep 17 00:00:00 2001 From: Ruslan Dautov Date: Mon, 23 Nov 2026 13:26:20 +0100 Subject: [PATCH] Keep the draft's tag when finishing macOS notarization Editing a draft release without resending tag_name makes GitHub rename the draft's tag to untagged-; publishing it would then create that tag. Send tag_name and target_commitish with the notes update, and fail if the tag is not the expected one afterwards. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/finish-notarization.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/finish-notarization.yml b/.github/workflows/finish-notarization.yml index 485920395..182de4855 100644 --- a/.github/workflows/finish-notarization.yml +++ b/.github/workflows/finish-notarization.yml @@ -144,9 +144,12 @@ jobs: # Remove the pending note from the release notes. python3 - <<'PY' import json, re - body = json.load(open("release.json")).get("body") or "" - body = re.sub(r"\n*", "", body, flags=re.S) - json.dump({"body": body}, open("patch.json", "w")) + r = json.load(open("release.json")) + body = re.sub(r"\n*", "", r.get("body") or "", flags=re.S) + # A draft keeps its tag name only if every edit sends it again; + # without it GitHub renames the draft's tag to "untagged-...". + json.dump({"body": body, "tag_name": r["tag_name"], "target_commitish": r["target_commitish"]}, open("patch.json", "w")) PY - gh api -X PATCH "repos/$repo/releases/$RELEASE_ID" --input patch.json >/dev/null + gh api -X PATCH "repos/$repo/releases/$RELEASE_ID" --input patch.json --jq .tag_name > tag_after + [ "$(cat tag_after)" = "$TAG" ] || { echo "::error::The release's tag is now $(cat tag_after), expected $TAG"; exit 1; } echo "::notice::The macOS DMG of $TAG is notarized and stapled. The release is still a draft: publish it when ready."