Skip to content

fix(publish-release): 🐛 wait for GitHub to list a draft created a moment ago - #126

Merged
robertodr merged 1 commit into
mainfrom
fix/publish-release-retry
Nov 19, 2026
Merged

robertodr merged 1 commit into
mainfrom
fix/publish-release-retry

Conversation

@robertodr

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Summary

Closes #125

The Publish run of v1.6.2 failed: publish-release listed the releases about 0.6 s after draft-release created the draft, found none for the tag, and stopped. The same listing showed the draft minutes later, and it was published by hand. GitHub's list of releases lags behind a new draft for a moment; it may also still show a draft that draft-release just deleted (a re-run), whose id then fails to publish.

  • publish-release now tries up to five times, waiting 2, 4, 8 and 16 s in between (about 30 s), while the listing doesn't show exactly one draft of the tag or publishing the draft it found fails. It logs each retry and fails with the same error after the last attempt (Found N draft releases of vX.Y.Z, expected exactly one. Run draft-release (again) first., or Could not publish the draft release <id> ...). A tag that is already published still needs nothing.
  • Tests: the fake gh can answer each listing differently, fail the publishing of given ids, and sleep only records its argument. New cases: a listing that shows the draft at the third attempt (the v1.6.2 case), a stale id that fails to publish followed by the right one, and the existing failure cases now check the five listings and the waits. 5 of the publish tests fail against the old action.
  • Docs: the action's description and the re-run caveat in docs/caveats.md.

Not verified against GitHub: how long the listing lags. 0.6 s was too short in the v1.6.2 run; 30 s is a guess with a wide margin. Adopters whose publish job runs minutes after draft-release (a package upload in between) weren't affected.

Checklist

  • Bug fix for the current release: add the backport label (or ask a maintainer to)
  • just lint and just test pass (ran the equivalents: ruff, ty, prek, full pytest 367 passed, 7 skipped; just isn't installed here)
  • docs/adopting.md, docs/organisation-setup.md, and docs/repository-setup.md updated if the stubs, inputs or setup changed
  • Breaking change or deprecation: the Migration section says what consumers must change

…ent ago

publish-release listed the releases 0.6 s after draft-release created
the draft of v1.6.2, found none and failed. The listing can also still
show a draft that draft-release just replaced. Try again with growing
waits, about 30 s in all, before failing.

Closes #125

Assisted-by: Pi:claude-opus-5-5
@robertodr robertodr added the backport Also ship this fix in the current release label Nov 19, 2026
@robertodr
robertodr merged commit ccba48f into main Nov 19, 2026
8 checks passed
@robertodr
robertodr deleted the fix/publish-release-retry branch November 19, 2026 09:41
@algorithmiq-release-bot

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release/1.6:

robertodr added a commit that referenced this pull request Nov 19, 2026
…ent ago (#127)

Backport of #126 to `release/1.6`.

:robot: _AI text below_ :robot:

## Summary

Closes #125

The Publish run of v1.6.2 failed: `publish-release` listed the releases
about 0.6 s after `draft-release` created the draft, found none for the
tag, and stopped. The same listing showed the draft minutes later, and
it was published by hand. GitHub's list of releases lags behind a new
draft for a moment; it may also still show a draft that `draft-release`
just deleted (a re-run), whose id then fails to publish.

- `publish-release` now tries up to five times, waiting 2, 4, 8 and 16 s
in between (about 30 s), while the listing doesn't show exactly one
draft of the tag or publishing the draft it found fails. It logs each
retry and fails with the same error after the last attempt (`Found N
draft releases of vX.Y.Z, expected exactly one. Run draft-release
(again) first.`, or `Could not publish the draft release <id> ...`). A
tag that is already published still needs nothing.
- Tests: the fake `gh` can answer each listing differently, fail the
publishing of given ids, and `sleep` only records its argument. New
cases: a listing that shows the draft at the third attempt (the v1.6.2
case), a stale id that fails to publish followed by the right one, and
the existing failure cases now check the five listings and the waits. 5
of the publish tests fail against the old action.
- Docs: the action's description and the re-run caveat in
`docs/caveats.md`.

Not verified against GitHub: how long the listing lags. 0.6 s was too
short in the v1.6.2 run; 30 s is a guess with a wide margin. Adopters
whose publish job runs minutes after `draft-release` (a package upload
in between) weren't affected.

## Checklist

- [ ] Bug fix for the current release: add the `backport` label (or ask
a maintainer to)
- [x] `just lint` and `just test` pass (ran the equivalents: ruff, ty,
prek, full pytest 367 passed, 7 skipped; `just` isn't installed here)
- [ ] docs/adopting.md, docs/organisation-setup.md, and
docs/repository-setup.md updated if the stubs, inputs or setup changed
- [ ] Breaking change or deprecation: the Migration section says what
consumers must change

Co-authored-by: Roberto Di Remigio Eikås <robertodr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Also ship this fix in the current release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publish-release fails right after draft-release: the new draft isn't listed yet

1 participant