feat: Add support for GHE / Data Residency#480
Open
mbianchidev wants to merge 7 commits into
Open
Conversation
…jects#479) Make all GitHub host references configurable via environment variables so the app can run against GHE.com Data Residency tenants (*.ghe.com) and GitHub Enterprise Server, in addition to github.com. - New helpers in src/utils/github-urls.ts derive server/API/OAuth URLs from GITHUB_SERVER_URL (with smart derivation: github.com -> api.github.com, *.ghe.com -> api.<tenant>.ghe.com, anything else -> <server>/api/v3). GITHUB_API_URL overrides derivation. - Octokit (bot/rest.ts) and Probot (pages/api/webhooks.ts) are configured with the derived baseUrl. createAppAuth requests also use the configured base URL via @octokit/request defaults. - NextAuth GitHub provider routes authorization/token/userinfo through the configured GHE host and uses a custom userinfo.request to fetch /user/emails from the configured API host (next-auth v4 hardcodes api.github.com otherwise). OAuth refresh URL uses env. - generateAuthUrl builds git remotes from GITHUB_SERVER_URL host. - Committer email domain is configurable via GITHUB_USER_EMAIL_DOMAIN (default users.noreply.github.com preserves current behavior). - UI components use getGitHubServerUrl() for fork/org links; client bundles read NEXT_PUBLIC_GITHUB_SERVER_URL / NEXT_PUBLIC_GITHUB_API_URL inlined at build time. - webhook-relay.mjs script wires baseUrl into octokit.App and warns when not targeting github.com (polling endpoint is best-effort on GHE). - .env.example and docs (README.md, docs/developing.md) document the GHE.com / GHES configuration and Docker build-arg requirement. - Added tests for URL derivation covering github.com defaults, GHE.com Data Residency, GHES, and explicit overrides. Defaults are unchanged, so existing github.com / GHEC deployments continue to work without any new configuration. Closes github-community-projects#479 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-support feat: add GHE.com Data Residency / GHES support (github-community-projects#479)
4 tasks
fix: correct GHES URL wiring and Docker client build args
Author
|
@wrslatz it should be ready for review 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive support for GitHub Enterprise Cloud with Data Residency (
*.ghe.com) and GitHub Enterprise Server (GHES) deployments that do not use GitHub connect.It introduces new environment variables for configuring GitHub server and API URLs, ensures these variables are available both server- and client-side, and updates the codebase to use these variables throughout authentication, API requests, UI links, and webhook relays. Documentation is also updated to guide users on configuring and building the app for GHE.com and GHES.
Enterprise GitHub configuration support:
GITHUB_SERVER_URL,GITHUB_API_URL,NEXT_PUBLIC_GITHUB_SERVER_URL,NEXT_PUBLIC_GITHUB_API_URL,GITHUB_USER_EMAIL_DOMAIN) in.env.exampleand documented their usage for GHE.com and GHES inREADME.mdanddocs/developing.md.env.mjsto support the new variables, ensuring they are available both server- and client-side.Authentication and API integration:
nextauth-options.tsto use the configured GitHub server/API URLs for OAuth endpoints and user info, overriding defaults to support GHE.com/GHES.UI and UX improvements:
github.comlinks in UI components with dynamic links based on the configured GitHub server URL, ensuring correct navigation for all deployments.These changes make the app robust and configurable for both public GitHub and enterprise GitHub deployments, improving flexibility and user experience across different hosting scenarios.