дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
feat(github): support GitHub Enterprise Server hosts in pull requests (#6729)
gh api does not take the host from the remote as gh pr does, so requests for an Enterprise repository went to github.com. GhApiRequest now carries an optional host passed as gh api --hostname (validated as host[:port]); the GitHub tool window sends the connected repository's host, availability reads the login on that host, and remotes on the host gh resolved count as GitHub remotes. Commit checks in the Git log keep github.com. Fixes #6717 Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
1 джерело
16e5cb5763
коміт
2ea7d6c41b
13 files changed
+223
-40
No files matched your search
@@ -413,13 +413,29 @@ export function repositoryDisplayName(
|
||||
return showOwner ? `${repo.owner}/${repo.name}` : repo.name;
|
||||
}
|
||||
|
||||
/** `owner/name` of a github.com remote URL (https, ssh or scp-like; SSH also via ssh.github.com), else null. */
|
||||
export function parseGitHubRemote(url: string): GHRepositoryCoordinates | null {
|
||||
const m =
|
||||
/^(?:(?:https?:\/\/(?:[^@/]+@)?|git:\/\/)(?:www\.)?|(?:ssh:\/\/(?:[^@/]+@)?|(?:[^@/]+@)?)(?:www\.|ssh\.)?)github\.com(?::\d+(?=\/))?[:/]+([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(
|
||||
url.trim(),
|
||||
);
|
||||
return m ? { owner: m[1]!, name: m[2]! } : null;
|
||||
/**
|
||||
* `owner/name` and host of a remote URL on github.com or one of `hosts` (GitHub Enterprise
|
||||
* Server, `ghe.example.com`), https, ssh or scp-like (SSH also via ssh.github.com), else null.
|
||||
*/
|
||||
export function parseGitHubRemote(
|
||||
url: string,
|
||||
hosts: readonly string[] = [],
|
||||
): (GHRepositoryCoordinates & { host: string }) | null {
|
||||
const names = ["github\\.com", ...hosts.map((h) => h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))].join("|");
|
||||
const m = new RegExp(
|
||||
`^(?:(?:https?:\\/\\/(?:[^@/]+@)?|git:\\/\\/)(?:www\\.)?|(?:ssh:\\/\\/(?:[^@/]+@)?|(?:[^@/]+@)?)(?:www\\.|ssh\\.)?)(${names})(?::\\d+(?=\\/))?[:/]+([^/]+)\\/([^/]+?)(?:\\.git)?\\/?$`,
|
||||
"i",
|
||||
).exec(url.trim());
|
||||
return m ? { owner: m[2]!, name: m[3]!, host: m[1]!.toLowerCase() } : null;
|
||||
}
|
||||
|
||||
/** The host of a repository URL from gh (`https://ghe.example.com/o/r` → `ghe.example.com`). */
|
||||
export function urlHost(url: string): string | null {
|
||||
try {
|
||||
return new URL(url).host.toLowerCase() || null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Заблокувати користувача