Files
orca/src/main/github/gh-utils.ts
T
Neil 19d082a164 fix(github): resolve owner/repo through SSH Host aliases (#10284) (#10361)
* fix(github): resolve owner/repo through SSH Host aliases (#10284)

Expand OpenSSH Host → HostName via ssh -G before classifying github.com
identity so PR merge works when origin is git@alias:owner/repo.git.
Transport URLs stay unchanged so IdentityFile selection is preserved.
Do not long-negative-cache indeterminate ssh -G failures.

* fix(github): harden SSH alias resolution
2026-07-25 23:34:17 -07:00

61 lines
1.7 KiB
TypeScript

import { execFile } from 'node:child_process'
import { promisify } from 'node:util'
import { gitExecFileAsync, ghExecFileAsync } from '../git/runner'
// Pure error-parsing helpers come from the lightweight module (not `runner`) so
// tests that mock `../git/runner` still resolve the real implementations.
import { extractExecError, parseRetryAfterMs } from '../git/exec-error'
// Why: legacy generic execFile wrapper - only used by callers that don't need
// WSL-aware routing. Repo-scoped callers should use the runner exports below.
export const execFileAsync = promisify(execFile)
export { ghExecFileAsync, gitExecFileAsync, extractExecError, parseRetryAfterMs }
export { classifyGhError, classifyListIssuesError } from './gh-error-classification'
export {
_getOwnerRepoCacheSize,
_resetOwnerRepoCache,
getOwnerRepoForRemote,
getRemoteUrlForRepo,
ghRepoExecOptions,
githubRepoContext,
parseGitHubOwnerRepo,
parseGitHubRemoteIdentity
} from './github-repository-identity'
export type {
GitHubRemoteIdentity,
GitHubRepoContext,
LocalGitExecOptions,
OwnerRepo
} from './github-repository-identity'
export {
getIssueOwnerRepo,
getOwnerRepo,
resolveIssueSource,
resolvePRRepositoryCandidates
} from './github-owner-repo-selection'
export type { PRRepositoryCandidates, ResolvedIssueSource } from './github-owner-repo-selection'
const MAX_CONCURRENT = 4
let running = 0
const queue: (() => void)[] = []
export function acquire(): Promise<void> {
if (running < MAX_CONCURRENT) {
running += 1
return Promise.resolve()
}
return new Promise((resolve) =>
queue.push(() => {
running += 1
resolve()
})
)
}
export function release(): void {
running -= 1
const next = queue.shift()
if (next) {
next()
}
}