Skip to content

chore(release): batch split-repo lookup and auto-create from release.sh#56

Merged
markshust merged 1 commit intodevelopfrom
feature/optimize-create-split-repos
May 2, 2026
Merged

chore(release): batch split-repo lookup and auto-create from release.sh#56
markshust merged 1 commit intodevelopfrom
feature/optimize-create-split-repos

Conversation

@markshust
Copy link
Copy Markdown
Collaborator

Why

During the 0.5.0 release, the split workflow failed for the three new inertia companion packages (marko-inertia-react, marko-inertia-vue, marko-inertia-svelte) because their split repos didn't exist on GitHub yet — bin/create-split-repos.sh hadn't been re-run since the packages were added. The fix at the time was manual: run the script, then re-trigger the failed workflow runs.

This shouldn't be a post-failure manual step. The release script should ensure the split repos exist before pushing.

What

bin/create-split-repos.sh

Three changes, all backwards-compatible (./bin/create-split-repos.sh with no args still works exactly as before):

  1. Single batched API call. The previous version did N sequential gh repo view calls (one per package), taking 30-60s for 77 packages. The new version makes one gh repo list call and compares the results locally with grep, completing in ~1s.
  2. Optional positional args. Pass package names to scope the check: ./bin/create-split-repos.sh inertia-react inertia-vue. With no args, every directory under packages/ is checked.
  3. --dry-run flag. Preview what would be created without any API mutations.

The script also validates each package's local directory exists before attempting to create its split repo, with a warning if not (catches typos in args).

Design note: no local state file. GitHub is the source of truth — the script fetches fresh on every run. No published-repos.txt to maintain, no drift risk if a repo is created/deleted out-of-band, nothing to commit after releases. Speed comes from batching one API call instead of N, not from caching.

bin/release.sh

Invokes bin/create-split-repos.sh between the changelog commit and the main-branch push. The split workflow fires on both the main push and the tag push, so the split repos must exist before either. The 1-second cost is trivial relative to the rest of the release.

.claude/release-process.md

  • Added new step 9 documenting the auto-invocation (renumbered subsequent steps).
  • Updated the troubleshooting note for the missing-split-repo case to reflect that this is now rare, and to document the new args/dry-run modes.

Verification (all run locally before opening this PR)

  • ./bin/create-split-repos.sh --dry-run → 0 created, 77 already exist, completed in 1.2s
  • ./bin/create-split-repos.sh --dry-run inertia-react inertia-vue inertia-svelte → 0 created, 3 already exist, completed in 0.9s
  • ./bin/create-split-repos.sh --dry-run nonexistent-test-pkg → correctly warns "packages/nonexistent-test-pkg does not exist — skipping"
  • Simulated would-create path with a temporary fake package dir → correctly printed "Would create marko-php/marko-test-fake-pkg-pretend"
  • bash -n bin/create-split-repos.sh and bash -n bin/release.sh both pass syntax check
  • No production code touched — bin/ scripts and docs only

Test plan for the next release

The next time ./bin/release.sh X.Y.Z runs, it will print "Verifying split repos exist for all packages..." between the changelog commit and the main push. If everything is in order, it'll show "Done: 0 created, N already existed" in ~1s and proceed normally.

🤖 Generated with Claude Code

## Why

During the 0.5.0 release, the split workflow failed for the three new
inertia companion packages because their split repos didn't exist on
GitHub yet — bin/create-split-repos.sh hadn't been re-run since the
packages were added. The fix at the time was manual: run the script,
then re-trigger the failed workflow runs. This shouldn't be a
post-failure manual step.

## What

### bin/create-split-repos.sh

- **Single batched API call.** The previous version did N sequential
  `gh repo view` calls (one per package), taking 30-60s for 77 packages.
  The new version makes one `gh repo list` call and compares locally,
  completing in ~1s.
- **Optional positional args.** Pass package names to scope the check:
  `./bin/create-split-repos.sh inertia-react inertia-vue`. With no args,
  every directory under packages/ is checked (preserves existing
  behavior).
- **--dry-run flag.** Preview what would be created without making any
  API calls. Used during local testing of this change.
- **Validates package directory exists** before attempting to create a
  split repo, with a warning if not (catches typos in args).
- **No local state file.** GitHub is the source of truth; the script
  fetches fresh on every run. No drift risk, nothing to commit after
  releases.

### bin/release.sh

Invokes `bin/create-split-repos.sh` between the changelog commit and the
main-branch push. The split workflow fires on both the main push and the
tag push, so the split repos must exist before either. The 1-second cost
is trivial relative to the rest of the release.

### .claude/release-process.md

- Added new step 9 documenting the auto-invocation (renumbered subsequent
  steps).
- Updated the troubleshooting note for the missing-split-repo case to
  reflect that this is now rare and to document the new args/dry-run
  modes.

## Verification

Local dry-run (no actual API mutations):
- `./bin/create-split-repos.sh --dry-run` → 0 created, 77 already exist,
  completed in 1.2s.
- `./bin/create-split-repos.sh --dry-run inertia-react inertia-vue
  inertia-svelte` → 0 created, 3 already exist, completed in 0.9s.
- `./bin/create-split-repos.sh --dry-run nonexistent-test-pkg` →
  correctly warns "packages/nonexistent-test-pkg does not exist —
  skipping".
- Simulated would-create path with a temporary fake package dir →
  correctly printed "Would create marko-php/marko-...".
- Both scripts pass `bash -n` syntax check.
@github-actions github-actions Bot added the maintenance Dependency updates and housekeeping label May 2, 2026
@markshust markshust merged commit fc9e264 into develop May 2, 2026
1 check passed
@markshust markshust deleted the feature/optimize-create-split-repos branch May 2, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Dependency updates and housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant