Skip to content

chore(release): make release.sh idempotent, merge via auto-merge, retire the release skill#650

Merged
lwshang merged 4 commits into
mainfrom
lwshang/fix_release
Jul 16, 2026
Merged

chore(release): make release.sh idempotent, merge via auto-merge, retire the release skill#650
lwshang merged 4 commits into
mainfrom
lwshang/fix_release

Conversation

@lwshang

@lwshang lwshang commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

⚠️ Merge order: merge this PR first

This PR must merge before #649 ("chore: update docs site to v1.1", branch release/docs-v1.1.0).

#649 is a bot-authored PR that edits docs-site/versions.json, and it is currently blocked: the approved-files CI check fails because that path isn't in .github/repo_policies/BOT_APPROVED_FILES. This PR adds it. Once this lands on main, re-run #649's checks and it will pass, unblocking the v1.1 docs update.


Summary

Hardening for the release flow, driven by friction hit during the v1.1.0 release.

  • No more non-actionable prompts. Removed the two confirm() calls (Proceed?, Push tag?) that interrupted the flow without offering a decision the driver could act on.
  • Auto-merge everywhere. wait_for_approval_and_merge now enables auto-merge (gh pr merge --auto) instead of a plain merge. Approving while required checks are still pending no longer errors with "the base branch policy prohibits the merge" (the failure seen on homebrew-tap#44). It also tolerates the reviewer enabling auto-merge by hand, then polls until the PR actually lands.
  • Approve early. Because the merge wait now sits through CI itself, steps 1 and 6 no longer pre-wait for checks — you can approve a PR the moment it opens. The wait ends only once checks conclude without merging (likely a failed required check) or an absolute backstop trips.
  • Every step is idempotent / re-runnable. Each publish step first checks whether the work is already done and picks up in-flight work instead of duplicating it:
    • npm — skip if the version is already on the registry; else watch an in-flight run or dispatch one.
    • homebrew — skip if the formula is already bumped; watch an existing update PR; else dispatch the workflow and wait for its PR to merge.
    • docs — skip if versions.json already lists the minor; watch an existing docs PR; else deploy + open + merge as before.
  • CI fix (unblocks chore: update docs site to v1.1 #649). Add docs-site/versions.json to BOT_APPROVED_FILES so the bot-authored docs-versions PR passes the approved-files check (this blocked step 6 during v1.1.0).
  • Retire the release skill. .claude/skills/release/* is superseded by scripts/release.sh and removed to avoid two drifting sources of truth.

Testing

  • bash -n scripts/release.sh passes.
  • Every gh / curl / awk probe added to the script (npm registry check, formula version read, ongoing-run lookup, gh pr checks --json bucket, autoMergeRequest, gh pr view by deleted branch) was validated against the live repos.

🤖 Generated with Claude Code

lwshang and others added 3 commits July 15, 2026 15:41
Remove the two non-actionable confirm() prompts (Proceed?, Push tag?)
that interrupted the flow without offering a meaningful decision.

Fix the homebrew-tap merge failure: wait_for_approval_and_merge now
enables auto-merge (--auto) instead of a plain merge, so approving while
required checks are still pending no longer errors ("base branch policy
prohibits the merge"). It tolerates the reviewer enabling auto-merge by
hand, then polls until the PR actually lands. Because it sits through CI
itself, steps 1 and 6 no longer pre-wait for checks — you can approve
immediately. The wait ends only once checks conclude without merging
(likely a failed required check) or an absolute backstop.

Make each publish step skip-if-done and pick up in-flight work:
- npm: skip if the version is already on the registry, else watch an
  in-flight run or dispatch one.
- homebrew: skip if the formula is already bumped, watch an existing
  update PR, else dispatch the workflow and wait for its PR to merge.
- docs: skip if versions.json already lists the minor, watch an existing
  docs PR, else deploy + open + merge as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 20:19

Copilot AI 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.

Pull request overview

Hardens and centralizes the release workflow in scripts/release.sh.

Changes:

  • Adds resumable npm, Homebrew, docs, and PR automation.
  • Enables approval-first auto-merge handling.
  • Retires the legacy release skill and permits bot docs-version updates.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/release.sh Adds idempotency probes and auto-merge polling.
.github/repo_policies/BOT_APPROVED_FILES Allows bot updates to docs versions.
.claude/skills/release/SKILL.md Removes the legacy skill entry point.
.claude/skills/release/task1-bump-pr.md Removes bump-PR instructions.
.claude/skills/release/task2-tag.md Removes tagging instructions.
.claude/skills/release/task3-release-wf.md Removes release-monitoring instructions.
.claude/skills/release/task4-npm.md Removes npm publishing instructions.
.claude/skills/release/task5-tap.md Removes tap publishing instructions.
.claude/skills/release/task6-docs.md Removes docs release instructions.
.claude/skills/release/task7-homebrew-core.md Removes Homebrew core status instructions.
.claude/skills/release/rollback.md Removes legacy rollback guidance.
Comments suppressed due to low confidence (1)

.claude/skills/release/SKILL.md:1

  • Deleting this release entry point removes beta-release automation, but scripts/release.sh only accepts stable X.Y.Z versions while this skill accepted X.Y.Z-beta.N and passed the npm beta flag. The PR describes the script as superseding the skill without stating that beta releases are being retired, so retain a beta-capable path or add equivalent support before removing the skill.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/release.sh
Comment thread scripts/release.sh
Comment thread scripts/release.sh
Comment thread scripts/release.sh
Fixes from Copilot review on #650:

- Tag step: reuse a local tag left behind when a previous run created it
  but failed to push, after checking it points at the release commit;
  bail if it points elsewhere. Previously a rerun died on "tag already
  exists".
- ensure_release_pr: if a release-pr.yml run is still opening the PR,
  watch that run before dispatching another, so two runs don't race to
  force-push/create the same branch.
- npm step: after ensure_workflow_run (which matches on workflow, not
  version) verify the version actually landed on npm, so watching an
  unrelated in-flight run can't be mistaken for a successful publish.
- publish-all.sh: skip any package whose version is already on the
  registry. A run that failed after publishing some platform packages
  but before the main package now resumes instead of erroring with 403
  ("cannot publish over the previously published version").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lwshang
lwshang marked this pull request as ready for review July 15, 2026 20:36
@lwshang
lwshang requested a review from a team as a code owner July 15, 2026 20:36
@lwshang
lwshang enabled auto-merge (squash) July 15, 2026 20:36
@lwshang
lwshang merged commit d7b5167 into main Jul 16, 2026
92 checks passed
@lwshang
lwshang deleted the lwshang/fix_release branch July 16, 2026 00:04
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.

3 participants