fix: auto-inject GH_HOST from GITHUB_SERVER_URL when --env-all is used#1453
fix: auto-inject GH_HOST from GITHUB_SERVER_URL when --env-all is used#1453
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
|
🔮 Oracle smoke report
Warning
|
There was a problem hiding this comment.
Pull request overview
Fixes missing GH_HOST derivation when --env-all is enabled so the gh CLI inside the agent container targets the correct GitHub host on GHES/GHEC runners.
Changes:
- Move
GH_HOSTauto-injection logic to run after theenvAll/selective env pass-through split, so it executes in both paths. - Add a guard to avoid overwriting an explicitly provided
GH_HOSTwhen it is already present. - Add unit tests to cover
envAll: truebehavior for both injection and non-overwrite cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/docker-manager.ts |
Ensures GH_HOST is derived from GITHUB_SERVER_URL even when --env-all is used, without clobbering an explicit GH_HOST. |
src/docker-manager.test.ts |
Adds tests validating auto-injection under envAll: true and preservation of an explicit GH_HOST. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GH_HOSTauto-injection fromGITHUB_SERVER_URLwas skipped when--env-allwas active because the logic lived inside theelsebranch. Sincegh-awalways passes--env-all,GH_HOSTwas never derived, causingghCLI inside the container to default togithub.comon GHES/GHEC runners.Changes
src/docker-manager.ts: MovedGH_HOSTauto-injection after theif/elseblock so it runs in both theenvAlland selective pass-through paths. Added a!environment.GH_HOSTguard so an explicitGH_HOSTalready forwarded via--env-allis not overwritten.src/docker-manager.test.ts: Added two unit tests covering the new behaviour:envAll: true+GITHUB_SERVER_URLset (noGH_HOST) → auto-injects correctlyenvAll: true+ bothGITHUB_SERVER_URLand explicitGH_HOSTset → explicit value is preserved💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.