Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurrentRepository() fails when executed inside a GH Workflow #34

Closed
chelnak opened this issue May 8, 2022 · 1 comment · Fixed by #36
Closed

CurrentRepository() fails when executed inside a GH Workflow #34

chelnak opened this issue May 8, 2022 · 1 comment · Fixed by #36
Assignees
Labels
bug Something isn't working

Comments

@chelnak
Copy link
Contributor

chelnak commented May 8, 2022

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:

unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host

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!

@samcoe samcoe added the bug Something isn't working label May 9, 2022
@samcoe
Copy link
Contributor

samcoe commented May 9, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants