Skip to content

bug: add-wizard --create-pull-request fails on GHES/Proxima — --hostname flag invalid for gh repo view and gh pr create #26310

@lpcox

Description

@lpcox

Bug

gh aw add-wizard with --create-pull-request and gh aw audit fail on GitHub Enterprise Server and Proxima (data residency) deployments because --hostname is passed to gh subcommands that do not support it.

Example error from add-wizard:

✗ failed to add workflow
failed to create PR
failed to get current repository info
exit status 1: unknown flag: --hostname
Usage: gh repo view [] [flags]

Root Cause

--hostname is only a valid flag on gh api. It does not exist on gh repo view, gh pr create, or gh run view.

Three call sites incorrectly pass --hostname to non-gh api commands:

1. pkg/cli/pr_command.go:777gh repo view

repoViewArgs := []string{"repo", "view", "--json", "owner,name"}
if remoteHost != "github.com" {
    repoViewArgs = append(repoViewArgs, "--hostname", remoteHost)  // ❌ invalid
}

2. pkg/cli/pr_command.go:804gh pr create

prCreateArgs := []string{"pr", "create", "--repo", repoSpec, ...}
if remoteHost != "github.com" {
    prCreateArgs = append(prCreateArgs, "--hostname", remoteHost)  // ❌ invalid
}

3. pkg/cli/audit.go:588gh run view

args := []string{"run", "view"}
// ...
if hostname != "" && hostname != "github.com" {
    args = append(args, "--hostname", hostname)  // ❌ invalid
}

All three were introduced in #20898.

Correct Usages (no change needed)

These all correctly pass --hostname to gh api:

File Line Command
audit.go:772 gh api
audit.go:850 gh api
logs_download.go:303 gh api
logs_download.go:500 gh api
audit_comparison.go:479 gh api
remote_fetch.go:415 gh api

Proposed Fix

Replace --hostname with the GH_HOST environment variable for the three affected call sites. The RunGH / RunGHWithEnv helper should accept an optional env override:

// For gh repo view and gh pr create — set GH_HOST in the process environment
env := os.Environ()
if remoteHost != "github.com" {
    env = append(env, "GH_HOST="+remoteHost)
}

For gh run view in audit.go, the same GH_HOST approach applies.

Affected Commands

  • gh aw add-wizard <workflow> --create-pull-request (on GHES/Proxima repos)
  • gh aw add <workflow> --create-pull-request (on GHES/Proxima repos)
  • gh aw audit <run-id> (on GHES/Proxima repos — job-level audit path)

The bug only triggers when the git remote host is not github.com.

Reported Via

Customer escalation: https://github.com/github/copilot-agent-runtime/issues/5313#issuecomment-4247334484 (Verizon on Proxima/data residency)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions