Skip to content

Add --resume option to cut-branch to continue an interrupted cut#6

Open
zeyap wants to merge 1 commit into
react-native-community:mainfrom
zeyap:cut-branch-resume
Open

Add --resume option to cut-branch to continue an interrupted cut#6
zeyap wants to merge 1 commit into
react-native-community:mainfrom
zeyap:cut-branch-resume

Conversation

@zeyap

@zeyap zeyap commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

cut-branch aborts at step 4 if the stable branch already exists, and there's no way to pick up a cut that was interrupted partway through (e.g. the branch got created but the Hermes bump / template branch / follow-up steps never ran). Today the only recovery is to delete the stable branch and start over — which is impossible when the branch is protected.

This adds a --resume <step> option that skips every step before the given number (including the "branch already exists" abort), so an interrupted cut can be continued from the middle.

What's included

  • --resume <n> runs steps n..13; all earlier steps are skipped.
  • --resume with no value prints the list of 13 steps and exits, so you can find the number to resume from.
  • When resuming into the branch-local steps (8–12), the stable branch is checked out first, since the normal checkout step (7) is skipped on resume. This protects the Hermes commit/push (step 12) from landing on the wrong branch.
  • Step titles now live in a single STEP_TITLES array that also drives TOTAL_STEPS, so the count can't drift.
  • The existing "branch already exists" error now hints to re-run with --resume <step>.

Note: steps 5 (resolve source) and 6 (create branch) are coupled — the resolved SHA feeds branch creation — so they're gated together (--resume 6 runs both).

Test plan

  • cut-branch --series 0.87 --resume → lists all 13 steps and exits without side effects.
  • cut-branch --series 0.87 --resume 8 --dry-run → prints "Resuming from step 8/13", skips steps 1–7, and starts at [8/13].
  • cut-branch --series 0.87 (no --resume) → unchanged behavior, runs 1→13.
  • Invalid values (--resume 0, --resume 99, --resume abc) → clear error and exit 1.
zeyap@zeyap-mac react-native % node /tmp/rn-release-automator/dist/index.js cut-branch --series 0.87 --resume
ℹ cut-branch runs 13 steps. Use --resume <n> to start from step n:

   1. Verify repository state (in react-native, on main, clean working dir)
   2. Check CI status on main (Test All)
   3. Update external dependencies support table
   4. Check the stable branch does not already exist
   5. Resolve the source commit to cut from
   6. Create the stable branch on GitHub
   7. Check out the stable branch locally
   8. Create the stable branch in react-native-community/template
   9. Inform the CLI channel on Discord
  10. Trigger the React Native nightly
  11. Hermes release
  12. Bump Hermes version on the release branch
  13. Follow-up tasks (Hermes on main, monorepo version bump)

  Note: steps 5 and 6 run together (resolve source + create branch).
zeyap@zeyap-mac react-native % node /tmp/rn-release-automator/dist/index.js cut-branch --series 0.87 --resume 7

⚛️  ━━━ Cut Branch — 0.87 series ━━━

  📖 https://github.com/reactwg/react-native-releases/blob/main/docs/guide-release-candidate.md

ℹ Resuming from step 7/13 — earlier steps will be skipped.

[7/13] Checking out 0.87-stable locally...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 20 (delta 5), reused 7 (delta 5), pack-reused 5 (from 1)
Unpacking objects: 100% (20/20), 9.48 KiB | 255.00 KiB/s, done.
From https://github.com/react/react-native
   d06174fbfe4..347f8d081ee  main          -> origin/main
 * [new branch]              zeyap-patch-1 -> origin/zeyap-patch-1
Already on '0.87-stable'
Your branch is up to date with 'origin/0.87-stable'.
✔ Checked out 0.87-stable
[8/13] Creating branch 0.87-stable in react-native-community/template...
✔ Branch 0.87-stable already exists in template repo
[9/13] Inform CLI channel on Discord...
ℹ Post this message to #cli on Discord:

  Hey, cutting 0.87-stable on react-native now, FYI in case CLI wants to cut a new major 🙂

? Inform Discord?
❯ Open Discord channel in browser
  Skip

↑↓ navigate • ⏎ select

cut-branch aborts if the stable branch already exists and has no way to
pick up a partially completed cut. This adds --resume <step> to skip all
steps before the given number (and the branch-exists abort), so an
interrupted cut can be continued from the middle.

- --resume <n> runs steps n..13; earlier steps are skipped
- --resume with no value lists the 13 steps and exits
- when resuming into the branch-local steps (8-12), the stable branch is
  checked out first since the normal checkout step (7) is skipped
- step titles now live in a single STEP_TITLES array that also drives the
  total step count
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