Skip to content

ci(npm): rebase-and-retry the version-bump push so publishes stop failing - #5762

Merged
leaanthony merged 2 commits into
masterfrom
ci/publish-npm-rebase-retry
Jul 6, 2026
Merged

leaanthony merged 2 commits into
masterfrom
ci/publish-npm-rebase-retry

Conversation

@taliesin-ai

@taliesin-ai taliesin-ai commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Every publish-npm.yml run since 2026-06-29 has failed at the Commit regenerated runtime + version bump step: master moves while the job runs (nightly release, auto-changelog commits), the bare git push is rejected with non-fast-forward, and the job dies before npm publish. Net effect: @wailsio/runtime on npm has been stale at 3.0.0-alpha.95 while master's runtime source moved on — and every stock wails3 init pulls latest from npm.

This adds a rebase-and-retry loop (5 attempts, linear backoff) around the push. A genuine rebase conflict still fails the job loudly, and the publish step still only runs after the bump commit is safely on master, so the version-bump-before-publish invariant is preserved.

After merging, a manual gh workflow run publish-npm.yml will refresh npm (and pick up #5690's runtime change once that lands).

Type of change

  • Bug fix (CI)

Checklist

  • Workflow-only change; no Go/TS code touched

Summary by CodeRabbit

  • Bug Fixes
    • Improved the release process to better handle push conflicts by automatically retrying when concurrent updates are detected.
    • Added a safeguard to stop the workflow with an explicit failure if the version update cannot be pushed after multiple attempts, reducing the risk of inconsistent releases.

…ling

master regularly moves while publish-npm.yml runs (nightly release and
auto-changelog commits), so the bare 'git push' of the version bump was
rejected with non-fast-forward and the job died before reaching
'npm publish'. Every run since 2026-06-29 failed this way, leaving
@wailsio/runtime stale on npm at 3.0.0-alpha.95 while master's runtime
source moved on - and every fresh 'wails3 init' pulls that stale package.

Rebase onto current master and retry (5 attempts, backoff) before giving
up. A genuine rebase conflict still fails the job loudly, and the publish
step still only runs after the bump commit is safely on master.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 07d31300-7c45-490c-9a44-09f36be05e27

📥 Commits

Reviewing files that changed from the base of the PR and between e90f5fd and 74940ff.

📒 Files selected for processing (1)
  • .github/workflows/publish-npm.yml

Walkthrough

The publish-npm GitHub Actions workflow now retries rejected git push operations up to five times, rebasing onto origin/master and pausing between attempts before failing the step explicitly.

Changes

Workflow Push Retry

Layer / File(s) Summary
Push retry loop with rebase and failure handling
.github/workflows/publish-npm.yml
Single git push is replaced with a 5-attempt retry loop that rebases onto origin/master, sleeps between attempts, and exits non-zero with an error if all retries fail.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: leaanthony

Poem

A push that bounced? I hop again,
Rebase, then wait — a rabbit’s refrain.
Five small tries and then success,
A tidy hop to ship the rest.
🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the workflow fix for retrying version-bump pushes before publish.
Description check ✅ Passed The description clearly explains the fix, motivation, and change type, but it omits the explicit fixed issue reference and testing details from the template.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/publish-npm-rebase-retry

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/publish-npm.yml (1)

145-163: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Rebase conflicts aren't detected — they masquerade as repeated push failures.

The run block has no set -e, and the exit status of git pull --rebase origin master (Line 159) is never checked. If a real rebase conflict occurs, git leaves the repo mid-rebase with unmerged paths, but the script doesn't stop — it sleeps and loops back to git push, which fails again, then re-runs git pull --rebase while already mid-rebase (which itself errors), silently, for all remaining attempts. The job eventually fails, but only after burning through all 5 attempts/backoff delays, and reports the generic "could not push after 5 attempts" message instead of surfacing the actual conflict — the opposite of "fails loudly" the PR intends.

🔧 Proposed fix: detect rebase conflicts explicitly and fail fast
+          set -eo pipefail
           git add -A
           echo "Files committed back to master:"
           git status --short
           git commit -m "[skip ci] Publish `@wailsio/runtime` ${{ steps.bump-version.outputs.version }}"
           for attempt in 1 2 3 4 5; do
             if git push; then
               exit 0
             fi
             echo "push rejected (attempt ${attempt}); rebasing onto current master"
-            git pull --rebase origin master
+            if ! git pull --rebase origin master; then
+              echo "::error::rebase onto origin/master failed — real conflict, aborting"
+              git rebase --abort || true
+              exit 1
+            fi
             sleep $(( attempt * 5 ))
           done
           echo "::error::could not push the version bump after 5 attempts"
           exit 1
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-npm.yml around lines 145 - 163, The retry loop in
the publish step treats rebase conflicts like ordinary push retries, so it can
keep looping while the repo is mid-rebase. Update the `run` block to fail fast
on `git pull --rebase origin master` errors in this `git push` retry flow, and
detect an in-progress rebase/unmerged paths before retrying. Use the existing
commit/push loop logic and the `git pull --rebase origin master` step to surface
the real conflict immediately instead of falling through to the generic
5-attempt failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/publish-npm.yml:
- Around line 145-163: The retry loop in the publish step treats rebase
conflicts like ordinary push retries, so it can keep looping while the repo is
mid-rebase. Update the `run` block to fail fast on `git pull --rebase origin
master` errors in this `git push` retry flow, and detect an in-progress
rebase/unmerged paths before retrying. Use the existing commit/push loop logic
and the `git pull --rebase origin master` step to surface the real conflict
immediately instead of falling through to the generic 5-attempt failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 96b14187-8331-48c0-848b-8cda8f530f80

📥 Commits

Reviewing files that changed from the base of the PR and between 97f5f46 and e90f5fd.

📒 Files selected for processing (1)
  • .github/workflows/publish-npm.yml

@leaanthony
leaanthony merged commit 77fbbfa into master Jul 6, 2026
11 of 16 checks passed
@leaanthony
leaanthony deleted the ci/publish-npm-rebase-retry branch July 6, 2026 06:31
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.

2 participants