(runtime: PRRuntime, host: string)
| 36 | // --- Auth --- |
| 37 | |
| 38 | export async function checkGhAuth(runtime: PRRuntime, host: string): Promise<void> { |
| 39 | const result = await runtime.runCommand("gh", hostnameArgs(host, ["auth", "status"])); |
| 40 | if (result.exitCode !== 0) { |
| 41 | const stderr = result.stderr.trim(); |
| 42 | const hostHint = host !== "github.com" ? ` --hostname ${host}` : ""; |
| 43 | throw new Error( |
| 44 | `GitHub CLI not authenticated. Run \`gh auth login${hostHint}\` first.\n${stderr}`, |
| 45 | ); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | export async function getGhUser(runtime: PRRuntime, host: string): Promise<string | null> { |
| 50 | try { |
no test coverage detected