Commit 1af72d4
authored
* fix: resolve gh CLI token lookup for GHEC (.ghe.com) hosts
tokenFromGHCLI only mapped api.github.com → github.com before calling
`gh auth token --hostname`. For GHEC hosts (api.<slug>.ghe.com), the
api. prefix was not stripped, causing the CLI lookup to fail silently
and the provider to fall back to an unauthenticated client (401 errors).
Strip the api. prefix for GHEC hosts using the existing GHECAPIHostMatch
regex so the hostname matches how `gh` stores credentials.
Fixes #3188
* Add test cases
* Code updates according to PR feedback
- move hostname modification to separate function for easier testing
- test omdified to only test ghCLIHostFromAPIHost() without OS specific scripts
- line ending fixed
1 parent d2d9d44 commit 1af72d4
2 files changed
+57
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
500 | 513 | | |
501 | 514 | | |
502 | 515 | | |
503 | 516 | | |
504 | 517 | | |
505 | 518 | | |
506 | 519 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
| 520 | + | |
511 | 521 | | |
512 | 522 | | |
513 | 523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
0 commit comments