mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 20:06:10 +00:00
Keep repositories on their known public forge (#40542)
* fix(git): keep public forge ownership ahead of auth evidence * test(git): exercise forge admission with complete auth fixtures
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { foldWwwHostAlias, normalizeForgeWebHost } from './git-remote-host-alias'
|
||||
|
||||
type PublicForgeProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure-devops' | 'gitea'
|
||||
|
||||
/** Ownership only: callers retain their original endpoint and persisted host identity. */
|
||||
export function getPublicForgeProviderForHost(host: string): PublicForgeProvider | null {
|
||||
const hostname = normalizeForgeWebHost(foldWwwHostAlias(host).replace(/:\d+$/, ''))
|
||||
if (hostname === 'github.com' || hostname === 'ghe.com' || hostname.endsWith('.ghe.com')) {
|
||||
return 'github'
|
||||
}
|
||||
if (hostname === 'gitlab.com') {
|
||||
return 'gitlab'
|
||||
}
|
||||
if (hostname === 'bitbucket.org') {
|
||||
return 'bitbucket'
|
||||
}
|
||||
if (
|
||||
hostname === 'dev.azure.com' ||
|
||||
hostname.endsWith('.dev.azure.com') ||
|
||||
hostname.endsWith('.visualstudio.com')
|
||||
) {
|
||||
return 'azure-devops'
|
||||
}
|
||||
return hostname === 'codeberg.org' ? 'gitea' : null
|
||||
}
|
||||
Reference in New Issue
Block a user