Commit graph

17 commits

Author SHA1 Message Date
Babak K. Shandiz
139c2c4f9a
refactor: replace backport with strings.CutSuffix
The `cutSuffix` function was added to backport the functionality of
`strings.CutSuffix` from Go 1.20. Now that we're using Go 1.25, we can
safely replace our backport with the standard library function. Our
backport was an intact copy/paste of the stdlib implementation, so this
change does not alter any behavior.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-31 12:21:02 +00:00
Tyler McGoffin
0bd4e034ef Remove unnecessary code branches 2024-10-15 12:35:35 -07:00
Tyler McGoffin
81591a09b8 Use go-gh/auth package for IsEnterprise, IsTenancy, and NormalizeHostname 2024-10-15 11:56:43 -07:00
William Martin
352737cb60 Use api subdomains for commands using ghinstance package 2024-09-13 15:03:36 +02:00
Sam Coe
d21c11d774
Add tenancy support (#7636) 2023-06-30 11:20:53 +00:00
Mislav Marohnić
b94d07347f
Add support for garage.github.com (#6478) 2022-11-03 12:12:38 +00:00
vilmibm
4afb567d06 WIP: survey wrapper 2022-07-26 14:39:38 -05:00
Mislav Marohnić
583af3e54c
Allow gh auth git-credential to authenticate GitHub Gist requests (#3064)
* Allow `gh auth git-credential` to authenticate GitHub Gist requests

When there are stored credentials for `example.com`, allow using them to
authenticate requests to `gist.example.com` as well.

* Fix writing out of credential config

* remove unneccessary function

* actually delete

Co-authored-by: nate smith <vilmibm@github.com>
2022-01-14 22:18:07 +00:00
Mislav Marohnić
2c86e671f3 Enable gh auth login for github.localhost 2021-10-18 20:01:18 +02:00
Mislav Marohnić
54b2de2f2a Assume that github.localhost is available through http: and not https: 2021-10-18 20:01:18 +02:00
Josh Gross
e43777ebd2 Support github.localhost as a non-enterprise host 2021-10-18 20:01:18 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Mislav Marohnić
460d55f723 Move HostnameValidator to ghinstance 2020-10-21 16:31:20 +00:00
vilmibm
dc345a9f73 support --web for gist view 2020-09-14 10:33:29 -05:00
Mislav Marohnić
c095a4bead Allow explicitly specifying the hostname for gh operations
Accept the "HOST/OWNER/REPO" syntax or passing a full URL for both the
`--repo` flag and the GH_REPO environment variable and allow setting
GH_HOST environment variable to override just the hostname for
operations that assume "github.com" by default.

Examples:

    $ gh repo clone example.org/owner/repo
    $ GH_HOST=example.org gh repo clone repo

    $ GH_HOST=example.org gh api user
    $ GH_HOST=example.org gh gist create myfile.txt

    $ gh issue list -R example.org/owner/repo
    $ gh issue list -R https://example.org/owner/repo.git
    $ GH_REPO=example.org/owner/repo gh issue list
2020-08-12 16:16:34 +02:00
Mislav Marohnić
87632791d6 Add ghinstance tests 2020-07-27 20:09:57 +02:00
Mislav Marohnić
288d01318b Respect the hostname of current repository in queries 2020-07-23 22:31:08 +02:00