Skip to content

fix(publish): resume a partial publish by reusing the release commit - #709

Merged
goosewobbler merged 4 commits into
mainfrom
fix/707-resume-partial-publish
Oct 23, 2026
Merged

goosewobbler merged 4 commits into
mainfrom
fix/707-resume-partial-publish

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Description

Standalone publish couldn't resume after a failure past the commit stage: the re-run found nothing to commit and failed at git commit before any later stage was retried.

  • Commit stage: after git add, if nothing is staged and HEAD's subject matches the release commit message, it reuses HEAD and goes on to tagging (tags already at HEAD were already skipped). If nothing is staged and HEAD isn't the release commit, it throws GIT_COMMIT_ERROR naming both subjects. A dry run skips the add, so it commits as before.
  • changed stays accurate: git.committed stays false for a reused commit, so publishDidChange counts only what the re-run did.
  • Branch push on resume: the pipeline context tracks "release commit reused" separately, and the push stages push the branch when the commit was created or reused. The standing-PR path (skipGitCommit) is unchanged and still pushes tags only.
  • @releasekit/git: new hasStagedChanges() (diff --cached --quiet) on Git, GitCli and FakeGit.
  • Docs: docs/cli.md describes resuming instead of "isn't supported yet".

Related Issue(s)

Closes #707.

Type of Change

  • feat — New feature
  • fix — Bug fix
  • docs — Documentation change
  • refactor — Code refactoring
  • test — Adding or updating tests
  • chore — Maintenance, dependencies, tooling
  • Breaking change — Requires major version bump

Scope

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release
  • @releasekit/config
  • @releasekit/core
  • CI / workflows
  • Root / monorepo

Checklist

  • Lint passes (pnpm lint)
  • Tests pass (pnpm test)
  • Typecheck passes (pnpm typecheck)
  • Documentation updated (if applicable)
  • Breaking changes noted in description

Testing Notes

  • test/integration/resume-publish.spec.ts uses real git and a bare remote. The first releasekit publish --input fails at the push (exit 9, changed: true); after origin is fixed, the re-run succeeds with changed: false. It asserts exactly one release commit, and that the branch and v0.2.0 reached the remote at HEAD. It fails without the fix: at git commit, or on the missing remote branch with only the commit-stage change.
  • Unit tests: the commit stage (reuse, a missing tag created on the reused commit, a multi-line message matched on its subject, the throw when HEAD isn't the release commit, dry run); the branch push for a reused commit in runGitPushStage, preparePushSetup and pushPackageTag; publishDidChange false for a reused commit; hasStagedChanges in GitCli and FakeGit.
  • Full gate (lint, typecheck, tests) and the integration suite pass.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous multiline-message issue is fixed.

Summary

Allows a partial publish to resume by reusing the release commit.

  • A publish rerun reuses the release commit when it is already at HEAD.
  • A rerun that reuses the release commit also pushes its branch.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Stage release files] --> B{Any staged changes?}
  B -->|Yes| C[Create release commit]
  B -->|No| D{HEAD subject matches?}
  D -->|No| E[Stop with commit error]
  D -->|Yes| F[Reuse release commit]
  C --> G[Create missing tags]
  F --> G
  G --> H[Continue publishing and push branch and tags]
Loading

Reviews (2) · Last reviewed commit: "fix(publish): compare the release commit..." · Reviewed by Greptile

Re-running `publish` on the same tree after a failure past the commit
stage failed at `git commit` (nothing to commit). The commit stage now
reuses HEAD when nothing is staged and HEAD's subject matches the release
commit message, and still throws GIT_COMMIT_ERROR otherwise. A reused
commit leaves `git.committed` false, so `changed` reports only what the
re-run did. The push stages still push the branch for a reused commit.

Adds `hasStagedChanges` to the `@releasekit/git` seam.

Closes #707

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Standing release PR: #614 · v0.42.0 queued (4 packages) · open 82d 20h 45m · ✅ ready to merge

Release Preview — v0.41.2 → v0.42.0

Note: Labels on this PR are advisory in standing-pr mode. Bumps come from conventional commits in the standing PR; override by editing labels on the standing PR itself. Add release:immediate to bypass the standing PR and release this PR directly.

These changes will be added to the release PR (#614) when merged:

Changelog

monorepo 0.41.2 → 0.42.0

Changed

  • reword the resume comments for clarity
  • format the resume test and simplify the subject helper

Fixed

  • BREAKING apply schema publish defaults when the config has no publish block (publish) (PR #690 · closes #667)
  • compare the release commit by git's subject rules (publish)
  • resume a partial publish by reusing the release commit (publish) (#707)

All packages → 0.42.0 (sync versioning)

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release

After merge — predicted release

No version escalation — this PR's changes will be included in the queued release without affecting the projected versions.

Package Standing PR This PR After merge
monorepo 0.42.0 0.42.0 0.42.0

Updated automatically by ReleaseKit

Comment thread packages/publish/src/stages/git-commit.ts Outdated
Git's `%s` joins the first paragraph's lines with spaces, so a release
message with a second line directly under the subject never matched its
own first line and couldn't resume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goosewobbler
goosewobbler force-pushed the fix/707-resume-partial-publish branch from e3e8fa2 to 59ccb82 Compare October 23, 2026 14:31
github-actions Bot and others added 2 commits October 23, 2026 15:35
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goosewobbler
goosewobbler merged commit 5eb67e4 into main Oct 23, 2026
29 checks passed
@goosewobbler
goosewobbler deleted the fix/707-resume-partial-publish branch October 23, 2026 14:55
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.

Standalone publish can’t resume after a partial failure

1 participant