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

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:777 — gh 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:804 — gh pr create

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

3. pkg/cli/audit.go:588 — gh 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions