Skip to content

feat(cli): add void github update to change an existing connection's branch/executor - #238

Merged
Brooooooklyn merged 2 commits into
mainfrom
feat/void-github-update
Jul 1, 2026
Merged

Brooooooklyn merged 2 commits into
mainfrom
feat/void-github-update

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Motivation

Today there is no CLI way to change an existing GitHub deploy connection. void github connect returns 409 project already connected when a project is already connected, so the only way to flip the build executor (container ↔ github_actions) or move the deploy branch is a raw authenticated PATCH /projects/:id/github.

The concrete blocker: a monorepo whose Void app lives in a subdirectory must use the github_actions executor, but a project connected earlier as container can only be flipped via the raw API. This command closes that gap.

What it does

Adds void github update [project] [options], calling the existing platform API PATCH /projects/:id/github.

  • Resolves the project the same way connect does: positional / --project / VOID_PROJECT / linked .void/project.json.
  • Fetches the current connection (GET /projects/:id/github). A missing connection (404) maps to a friendly message pointing at void github connect first.
  • Sends only the changed fields to PATCH, and skips the API entirely when nothing changed (prints a "no changes" message).

Flags

Flag Description
--project <name> Project name (alias for the positional argument)
--branch <name> New branch to deploy from
--executor <type> New build executor: container or github_actions

--executor reuses connect's exact validation and error message (github: invalid --executor (expected container|github_actions).).

Interactive + non-TTY behavior

  • TTY: shows the current branch + executor, then prompts for a new branch (default = current) and executor (default = current) using the same @clack/prompts helpers connect uses.
  • Non-TTY: never prompts. Requires at least one of --branch / --executor; if neither is given it fails closed with a clear message.

Tests added

  • github-args.test.ts — update arg parsing (project positional/--project alias, --branch, --executor, validation + rejection cases) and the updated usage string.
  • github-client.test.ts — getGithubConnection (GET) and updateGithubConnection (PATCH) wire format, auth headers, exact JSON body, and error mapping.
  • github-cmd.test.ts — describeUpdateError (connect-first mapping + fallthrough to describeConnectError).
  • github-update-cmd.test.ts — command behavior (non-TTY): executor-only, branch-only, both, not-connected error, missing-flags error, no-op/no-changes path, and unresolvable-slug error.

All 102 github tests pass; vp fmt --check, vp lint, and packages/void typecheck are clean.

🤖 Generated with Claude Code


Note

Medium Risk
Changing deploy branch or executor affects which pushes trigger builds and how they run; the change is scoped to CLI + existing PATCH API with conservative validation and no-op guards.

Overview
Adds void github update [project] so users can change an existing GitHub auto-deploy connection’s deploy branch and/or build executor (container vs github_actions) without disconnecting or raw PATCH calls. Repo and installation stay unchanged; the project must already be connected via void github connect.

The CLI loads the current connection with GET /projects/:id/github, then PATCHes only fields that actually differ. If nothing changes, it prints a no-op message and skips the API. --branch values are trimmed on update so padded names don’t break deploy/OIDC matching.

TTY mode prompts for branch and executor (defaults = current). Non-TTY requires at least one of --branch / --executor; that check runs before project lookup or any API call so CI gets a usage error instead of a misleading “connect first” 404.

Also adds PlatformClient.getGithubConnection / updateGithubConnection, describeUpdateError (404 “connection not found” → connect-first guidance), help/docs wiring, and unit tests for parsing, HTTP client, and runGithubUpdate.

Reviewed by Cursor Bugbot for commit 1cc1cc7. Bugbot is set up for automated code reviews on this repo. Configure here.

Brooooooklyn and others added 2 commits July 1, 2026 15:09
…s branch/executor

There was no CLI way to change an already-connected GitHub deploy
connection: `void github connect` returns 409 when a project is already
connected, so flipping the build executor (container <-> github_actions)
or moving the deploy branch required a raw authenticated PATCH
/projects/:id/github. This is the real blocker for a monorepo whose Void
app lives in a subdirectory and must use the github_actions executor.

`void github update [project] [--branch <name>] [--executor <type>]`:
- resolves the project the same way `connect` does (positional /
  --project / VOID_PROJECT / linked .void/project.json)
- fetches the current connection (GET); a missing connection maps to a
  friendly "run `void github connect` first" message
- TTY: shows current branch + executor and prompts for new values,
  defaulting each to the current setting
- non-TTY: requires at least one of --branch / --executor, else fails
  closed
- sends only the changed fields to PATCH /projects/:id/github, and skips
  the API entirely when nothing changed

Adds PlatformClient.getGithubConnection + updateGithubConnection,
help/hint/docs entries, and unit tests (args parsing, client wire
format, error mapping, and command behavior for all paths).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… update (review)

Trim the --branch value in the `update` arg parser so a padded value like
'main ' can no longer be persisted (it would never match refs/heads/main at
OIDC exchange time and would cancel in-flight builds for the old branch). The
no-op check and PATCH now both use the canonical branch name. `connect` is left
unchanged.

Move the non-TTY missing-flags guard to the top of runGithubUpdate, before
project resolution and getGithubConnection, so `void github update <app>` with
no flags reports the usage error regardless of API state (a disconnected
project no longer surfaces the 404 "connect first" message in its place).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn merged commit d87815f into main Jul 1, 2026
7 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/void-github-update branch July 1, 2026 07:34
cpojer pushed a commit that referenced this pull request Sep 11, 2026
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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