We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a59838 commit 72846e8Copy full SHA for 72846e8
components/server/ee/src/prebuilds/github-enterprise-app.ts
@@ -77,9 +77,14 @@ export class GitHubEnterpriseApp {
77
): Promise<User> {
78
const span = TraceContext.startSpan("GitHubEnterpriseApp.findUser", ctx);
79
try {
80
- const host = req.header("X-Github-Enterprise-Host");
+ let host = req.header("X-Github-Enterprise-Host");
81
+ if (!host) {
82
+ // If the GitHub installation doesn't identify itself, we fall back to the hostname from the repository URL.
83
+ const repoUrl = new URL(payload.repository.url);
84
+ host = repoUrl.hostname;
85
+ }
86
const hostContext = this.hostContextProvider.get(host || "");
- if (!host || !hostContext) {
87
+ if (!hostContext) {
88
throw new Error("Unsupported GitHub Enterprise host: " + host);
89
}
90
const { authProviderId } = hostContext.authProvider;
0 commit comments