Skip to content

M8: GitHub Enterprise Server support#295

Draft
michaeljolley wants to merge 1 commit into
mjolley/m7-local-clonefrom
mjolley/m8-ghes
Draft

M8: GitHub Enterprise Server support#295
michaeljolley wants to merge 1 commit into
mjolley/m7-local-clonefrom
mjolley/m8-ghes

Conversation

@michaeljolley

Copy link
Copy Markdown

Final milestone of the RayCast parity roadmap. Stacked on top of #294 (M7).

What this adds

Make the GitHub host configurable end-to-end so the extension can target a GitHub Enterprise Server (GHES) instance in addition to github.com.

  • Central host resolver (\GitHubHostAddress): normalizes a user-entered host (bare host assumes https, empty means github.com), detects github.com vs GHES, and produces the Octokit REST API base (\https://api.github.com/\ or \https://HOST/api/v3/\) and the GraphQL endpoint (\https://api.github.com/graphql\ or \https://HOST/api/graphql\).
  • Shared host logic: \GitHubGraphQLClient\ now derives its endpoint through \GitHubHostAddress, so REST and GraphQL host logic have one source of truth.
  • Host-aware OAuth: \OAuthRequest\ accepts an optional host and builds its Octokit client against the enterprise API base; \IDeveloperIdProvider.LoginNewDeveloperIdAsync(host)\ threads the chosen host through sign-in. The parameterless path still defaults to github.com, and restored accounts already carry their own host.
  • Sign In form: an optional 'GitHub Enterprise Server host' field (blank keeps github.com); \SignInCommand.Invoke(host)\ passes it through.

Tests

  • Host parsing (empty, bare, scheme, unsupported scheme), github.com vs GHES API/GraphQL resolution, and the GraphQL client delegation.
  • 221/221 tests pass.

Notes

  • OAuth against a live GHES instance can't be exercised in this environment; the host resolution and client construction are unit tested, and the flow reuses the existing github.com OAuth path.
  • Per-account host was already supported when restoring saved accounts; this milestone extends it to the initial sign-in.

Make the GitHub host configurable end-to-end so the extension can target a
GitHub Enterprise Server (GHES) instance in addition to github.com.

- GitHubHostAddress: a single resolver for host-specific URLs. It normalizes a
  user-entered host (bare host assumes https, empty means github.com), detects
  github.com versus GHES, and produces the Octokit REST API base
  (https://api.github.com/ or https://HOST/api/v3/) and the GraphQL endpoint
  (https://api.github.com/graphql or https://HOST/api/graphql).
- GitHubGraphQLClient now derives its endpoint through GitHubHostAddress, so REST
  and GraphQL host logic share one source of truth.
- OAuth login is host-aware: OAuthRequest accepts an optional host and builds its
  Octokit client against the enterprise API base, and
  IDeveloperIdProvider.LoginNewDeveloperIdAsync(host) threads the chosen host
  through the sign-in flow. The parameterless path still defaults to github.com,
  and restored accounts already carry their own host.
- Sign In form gains an optional 'GitHub Enterprise Server host' field; blank
  keeps github.com. SignInCommand.Invoke(host) passes it through.
- ResW strings and tests: host parsing, github.com vs GHES API/GraphQL
  resolution, and the GraphQL client delegation. 221/221 tests pass.

Co-authored-by: Copilot App <223556219+Copilot@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