File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
components/server/ee/src/prebuilds Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,14 @@ export class GitHubEnterpriseApp {
77
77
) : Promise < User > {
78
78
const span = TraceContext . startSpan ( "GitHubEnterpriseApp.findUser" , ctx ) ;
79
79
try {
80
- const host = req . header ( "X-Github-Enterprise-Host" ) ;
80
+ 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
+ }
81
86
const hostContext = this . hostContextProvider . get ( host || "" ) ;
82
- if ( ! host || ! hostContext ) {
87
+ if ( ! hostContext ) {
83
88
throw new Error ( "Unsupported GitHub Enterprise host: " + host ) ;
84
89
}
85
90
const { authProviderId } = hostContext . authProvider ;
You can’t perform that action at this time.
0 commit comments