Commit ce17949
fix: use GH_HOST env var instead of --hostname flag for gh repo view and gh pr create (#26311)
* Initial plan
* fix: use GH_HOST env var instead of --hostname flag for gh repo view and gh pr create
The --hostname flag is only valid for `gh api`, not for `gh repo view` or
`gh pr create`. This caused failures on GHES/Proxima with:
"unknown flag: --hostname"
Replace the invalid --hostname flag with the GH_HOST environment variable,
which is the correct approach for these commands. Extract the env var setup
into a reusable setGHHostEnv helper to avoid duplication.
Fixes: gh aw add-wizard --create-pull-request on GHES/Proxima deployments
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9ad4e273-0356-4650-a286-ade3682b979c
Co-authored-by: lpcox <[email protected]>
* fix: replace --hostname with GH_HOST env var for non-api gh commands
Address review feedback on the original PR:
1. Add RunGHWithHost() and SetGHHostEnv() to pkg/workflow/github_cli.go
as shared helpers, preserving spinner UX and enrichGHError wrapping.
2. Fix pr_command.go to use RunGHWithHost() for gh repo view and
gh pr create (restores spinner + error enrichment lost in original PR).
3. Fix audit.go:588 — gh run view also does not support --hostname.
This was the third affected call site documented in #26310 but
missed in the original PR.
4. Remove the local setGHHostEnv() from pr_command.go in favor of
the shared exported SetGHHostEnv() in github_cli.go.
5. Add TestSetGHHostEnv with 5 test cases covering github.com no-op,
empty host no-op, GHES host, Proxima host, and append-to-existing-env.
Fixes #26310
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: lpcox <[email protected]>
Co-authored-by: Landon Cox <[email protected]>
Co-authored-by: Copilot <[email protected]>1 parent c25673e commit ce17949
File tree
4 files changed
+111
-22
lines changed- pkg
- cli
- workflow
4 files changed
+111
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
| 583 | + | |
| 584 | + | |
584 | 585 | | |
585 | 586 | | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | 587 | | |
592 | 588 | | |
593 | 589 | | |
| |||
600 | 596 | | |
601 | 597 | | |
602 | 598 | | |
603 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
604 | 602 | | |
605 | 603 | | |
606 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
782 | 777 | | |
783 | 778 | | |
784 | 779 | | |
| |||
797 | 792 | | |
798 | 793 | | |
799 | 794 | | |
800 | | - | |
801 | | - | |
| 795 | + | |
| 796 | + | |
802 | 797 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 798 | + | |
808 | 799 | | |
809 | 800 | | |
810 | 801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
0 commit comments