pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.28k stars 125 forks source link

Use hostname flag to get user name #389

Closed Shinzu closed 1 year ago

Shinzu commented 1 year ago

Describe what this PR does / why we need it

With this pr the local repo hostname is used to determine the Username for eg comments and other operations that need this username.

Does this pull request fix one issue?

Fixes #388

Describe how you did it

To determine the Username gh auth status is used, which also takes the flag --hostname. I added this flag to the gh auth status command with the remote host i get from the get_remote_host function from octo.utils.

If you have 2 hosts configured in ~/.config/gh/hosts.yml like github.com and a GHE instance, the current implementation only takes the first output in consideration to determine the username, which in my test is always github.com even if this is the second host configured in ~/.config/gh/hosts.yml.

With adding the --hostname flag we only consider the local repos remote for determine the username.

Describe how to verify it

You have 2 host configured in ~/.config/gh/hosts.yml and while create a comment on an issue the username on the host the repo is hosted on (github.com or GHE instance) is used in the comment.

Special notes for reviews

pwntester commented 1 year ago

LGTM, thanks for the contribution!