Closed chelnak closed 2 years ago
@chelnak This is unexpected behavior so I am going to classify it as a bug. You also correctly diagnosed what is happening here. The issue is that CurrentRepository()
does not consider github.com
as a valid host as it is not defined by GH_HOST
or in the ~/.config/gh/hosts.yml
file. I think adding in additional logic to config.Hosts()
to include github.com
in the return slice when there is an environment token defined is the correct solution here.
Hey - just discovered something that might be interesting.
When a consuming application calls
CurrentRepository()
from inside a GH workflow I'm seeing the following error:I think this is because
~/.config/gh/hosts.yml
does not exist on a runner because of the TOKEN based auth (vs oauth).This would cause FilterByHosts to return an error.
I have worked around this by. exporting the GH_HOST environment variable.. however it was not immediately obvious what to do.
If this is expected behaviour we could update the README with a note on compatibility with GH Actions.
Cheers!