Skip to content

fix(release): name the repository for the GitHub Release job - #27

Merged
zhanghanduo merged 1 commit into
mainfrom
fix/release-github-job-needs-repo
Sep 3, 2026
Merged

zhanghanduo merged 1 commit into
mainfrom
fix/release-github-job-needs-repo

Conversation

@zhanghanduo

Copy link
Copy Markdown
Collaborator

What happened on v0.3.0

PyPI published successfully. publish-github then failed:

failed to run git: fatal: not a git repository (or any of the parent directories): .git

The job downloads artifacts and never checks out the repository, so gh release had no git remote to infer its target from. The GitHub Release for v0.3.0 was created by hand from the same artifacts — sha256-verified identical to what PyPI holds.

Why this could not be fixed by rerunning

Two things made it unrecoverable in place, and both are worth writing down:

  1. A rerun replays the workflow definition at the tag. Fixing main does nothing for a tag already pushed.
  2. The PyPI version number was already consumed. 0.3.0 can never be reused — not by deleting the release, not by yanking — so retagging or bumping to redo the release was not an option either.

The ordering introduced in #25 did its job here: PyPI-then-GitHub meant the failure left no GitHub Release falsely claiming a version was published. It just left none at all.

The fix

GH_REPO: ${{ github.repository }} on the publishing step, rather than adding a checkout — the job needs the artifacts and nothing else from the repository.

A regression test asserts the job has no checkout and sets GH_REPO, so the two cannot drift apart again. Its docstring records the incident, because the cost of rediscovering this is a hand-made release.

Verification

ruff clean, full suite passes (21 tests in the release-automation module).

Not verifiable before merge: the fix only exercises on the next tag push. The regression test is what stands in for that.

The publish-github job downloads artifacts and never checks out the repository,
so `gh release` had no git remote to infer its target from and failed with
"fatal: not a git repository". This is what happened on v0.3.0: PyPI published
successfully and the GitHub Release had to be created by hand.

The failure is not recoverable by rerunning the job. A rerun replays the
workflow definition at the tag, so fixing main does not fix a tag already
pushed — and the PyPI version number is consumed by then and can never be
reused, so retagging is not an option either.

Set GH_REPO explicitly rather than adding a checkout: the job needs the artifacts
and nothing else from the repository.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zhanghanduo
zhanghanduo merged commit 856104e into main Sep 3, 2026
5 checks passed
@zhanghanduo
zhanghanduo deleted the fix/release-github-job-needs-repo branch September 3, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant