You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add docs on how to run from Github Actions CI/CD Workflow #1540
Describe the feature or problem you’d like to solve
I'd like to be able to run gh cli from within a github action. The only install action I see is to manually download on the linux-based github runner (container) is to curl a hard-coded url, which will be immediately stale and will need it's version updated periodically. Is this the best way? Is it already installed on github runners? Some documentation here would be extremely helpful. Thanks!
Proposed solution
Documentation on the recommended way to run within github actions would be much appreciated.
Additional context
I've searched google and the available repo docs and github docs to no avail.
Run echo "Checking out from PR URL: https://api.github.com/repos/slalom-ggp/dataops-infra/pulls/122"
Checking out from PR URL: https://api.github.com/repos/slalom-ggp/dataops-infra/pulls/122
Notice: authentication required
Press Enter to open github.com in your browser... /usr/bin/xdg-open: 851: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'https://github.com/login/oauth/authorize?client_id=178c6fc778ccc68e1d6a&redirect_uri=http%3A%2F%2F127.0.0.1%3A33511%2Fcallback&scope=repo+read%3Aorg+gist&state=2f9d7df6cfbb09aefbf7'
error opening web browser: exit status 3
Please open the following URL manually:
https://github.com/login/oauth/authorize?client_id=178c6fc778ccc68e1d6a&redirect_uri=http%3A%2F%2F127.0.0.1%3A33511%2Fcallback&scope=repo+read%3Aorg+gist&state=2f9d7df6cfbb09aefbf7
If you are on a server or other headless system, use this workaround instead:
1. Complete authentication on a GUI system;
2. Copy the contents of `~/.config/gh/hosts.yml` to this system.
Came here to look for the same and the update on 1.0.0 release, especially to utilize gh release. Instead, I ended up learning how nekos/act isn't exactly same as hosted github runners and what self-hosted runners are :) Glad I did.
Great to hear that gh will be available by default to Actions cloud runners, however, what would be the best way to make gh CLI available on self-hosted runners? I think this is the use case for something like actions/setup-cli.
Activity
aaronsteers commentedon Aug 15, 2020
Update: Installing works with the below but it fails to authenticate, prompting for a GUI-based URL MFA.
Failure log:
aaronsteers commentedon Aug 15, 2020
Any plans to do something like https://github.com/marketplace/actions/setup-hub?
mislav commentedon Aug 17, 2020
@aaronsteers GitHub CLI is pre-installed in Actions runners. To use it:
I understand that this has to be better documented; I'll add a label as a TODO item for us. Thanks for your ask!
aaronsteers commentedon Aug 17, 2020
@mislav - Awesome. That's a big help.
trim21 commentedon Sep 17, 2020
When version 1.0.0 could be included in github actions? I'm looking forward to use new feature of gh.
mislav commentedon Sep 17, 2020
@trim21 It usually doesn't take too long! In the meantime you can always download the binary directly from releases via a script.
tapsboy commentedon Sep 18, 2020
Came here to look for the same and the update on 1.0.0 release, especially to utilize
gh release. Instead, I ended up learning how nekos/act isn't exactly same as hosted github runners and what self-hosted runners are :) Glad I did.FWIW, I found this for anyone looking: https://github.com/actions/virtual-environments#updates-to-virtual-environments . It's a weekly cadence, so hopefully 1.0.0 will be in ubuntu-latest soon
happiness801 commentedon Sep 22, 2020
Great to hear that
ghwill be available by default to Actions cloud runners, however, what would be the best way to makeghCLI available on self-hosted runners? I think this is the use case for something likeactions/setup-cli.mislav commentedon Sep 23, 2020
@happiness801 Something like:
You will then be able to invoke
bin/ghin the current directory.