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

Bug: Username for Comments do not match for local repo config #388

Closed Shinzu closed 1 year ago

Shinzu commented 1 year ago

Issue Description

bug report: Username for comments do not match local repo config

Describe what happened (or what feature you want)

While writing a comment i recognized that it uses the username i have on github.com instead the one i have for the GHE instance on which the local repo is hosted.

As far as i can tell the username is derived from here:

https://github.com/pwntester/octo.nvim/blob/master/lua/octo/gh/init.lua#L45 which takes only the first occurrence in consideration.

Describe what you expected to happen

The username for comments etc should be local to the repo, eg if a github.com repo a github.com username, on GHE repo my GHE username.

How to reproduce it (as minimally and precisely as possible)

  1. have 2 host configured in ~/.config/gh/hosts.yml
  2. write a comment in GHE repo, username will be the one from github.com

Tell us your environment

Ubuntu 22.04 neovim nightly

Anything else we need to know?

in https://github.com/pwntester/octo.nvim/blob/master/lua/octo/gh/init.lua#L45 gh auth status is used to derive the username.

Even if github.com is second in ~/.config/gh/hosts.yml it will appear first in the list, from which then the username is derived

gh auth status also takes a --hostname flag which could be used to get the username for the local repo.