Skip to content

ci(release): repair orphaned draft tag_name on retag - #2761

Merged
myasnikovdaniil merged 1 commit into
mainfrom
fix/finalize-untagged-draft
Jun 5, 2026
Merged

myasnikovdaniil merged 1 commit into
mainfrom
fix/finalize-untagged-draft

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

When a release-cut PR is merged after the underlying git tag was deleted and re-created (e.g. the release branch was force-updated between the initial tag push and the merge), GitHub orphans the corresponding draft release — its tag_name becomes untagged-<hash> while name is preserved.

The "Publish draft release" step in pull-requests-release.yaml looks up the draft strictly by tag_name === tag and throws Draft release for <tag> not found, blocking the release. Observed on run #26558920814 cutting v1.4.2, and the same error fired on the earlier v1.4.1 finalize run.

This change adds a fallback: when the primary lookup misses, search for a draft where name === tag and tag_name matches /^untagged-/. If found, repair the draft's tag_name to the real tag via updateRelease before publishing, so the released artifact correctly points at the git tag created earlier in the same job. The strict-fail path is preserved when neither lookup matches.

The fix is forward-only and does not auto-recover the currently stuck v1.4.2 draft — that needs a one-time manual tag_name patch + job re-run, or publishing the draft via the GitHub UI.

Release note

ci(release): the release-finalize workflow now repairs an orphaned draft release (tag_name == `untagged-<hash>` after a tag delete + re-create) by re-linking it to the actual tag before publishing.

Summary by CodeRabbit

  • Chores
    • Improved the robustness of the release publication process to handle edge cases when locating draft releases, ensuring more reliable and consistent release deployments.

Review Change Stack

When the git tag was deleted and re-created between draft creation
and merge, GitHub orphaned the draft release: tag_name became
"untagged-<hash>" while `name` was preserved. The finalize step
looked up the draft by tag_name and threw `Draft release for <tag>
not found`, blocking the release.

Fall back to matching by `name` only when the candidate is the
GitHub-orphaned form (tag_name matches /^untagged-/), repair the
draft's tag_name via updateRelease, then publish. Hard-fail is
preserved when neither lookup matches.

Same failure recurred on the v1.4.1 finalize run; this commit
prevents recurrence but does not auto-recover the stuck v1.4.2
draft.

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions github-actions Bot added area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) size/S This PR changes 10-29 lines, ignoring generated files labels May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5fce15ff-e05b-4266-9bfa-b6e70b7f6b3b

📥 Commits

Reviewing files that changed from the base of the PR and between 8afb99b and 22187e0.

📒 Files selected for processing (1)
  • .github/workflows/pull-requests-release.yaml

📝 Walkthrough

Walkthrough

The release workflow's draft publication step now robustly handles edge cases where GitHub changes a draft's tag_name to untagged-<hash> while preserving the release name. The script first attempts to locate the draft by exact tag_name match, then falls back to searching for orphaned drafts by name and repairs them before publishing.

Changes

Draft Release Selection Robustness

Layer / File(s) Summary
Draft release location with orphan recovery
.github/workflows/pull-requests-release.yaml
Draft selection logic now searches by tag_name first, then handles orphaned drafts by matching name and repairing the tag_name field via updateRelease before using the draft for subsequent publishing steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A draft once orphaned, lost its name,
GitHub tagged it with a hash—so strange!
But now our workflow, wise and keen,
Finds what was lost, and heals the seam,
Restoring tags with gentle care. 📋✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: repairing an orphaned draft's tag_name during release re-tagging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/finalize-untagged-draft

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added area/ci Issues or PRs related to CI workflows, GitHub Actions, automation kind/bug Categorizes issue or PR as related to a bug labels May 28, 2026
@myasnikovdaniil myasnikovdaniil self-assigned this May 28, 2026
@myasnikovdaniil myasnikovdaniil added kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line labels Jun 5, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 26574f0 into main Jun 5, 2026
18 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the fix/finalize-untagged-draft branch June 5, 2026 08:54
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Successfully created backport PR for release-1.4:

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Successfully created backport PR for release-1.3:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Issues or PRs related to CI workflows, GitHub Actions, automation area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/bug Categorizes issue or PR as related to a bug size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants