Repository navigation
Add docs on how to run from Github Actions CI/CD Workflow #1540
Description
Activity
Update: Installing works with the below but it fails to authenticate, prompting for a GUI-based URL MFA.
- name: Install GitHub CLI run: | URL=https://github.com/cli/cli/releases/download/v0.11.1/gh_0.11.1_linux_amd64.deb TEMP_DIR="$(pwd)" TEMP_DEB="$(pwd)/gh_0.11.1_linux_amd64.deb" wget -O "$TEMP_DEB" "$URL" ls -la $TEMP_DIR sudo apt install "$TEMP_DEB" rm -f "$TEMP_DEB"Failure log:
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.Any plans to do something like https://github.com/marketplace/actions/setup-hub?
Reacted by Rubens Mariuzzo, Kevin Gwynn and Bastian Zimmermann@aaronsteers GitHub CLI is pre-installed in Actions runners. To use it:
- uses: actions/checkout@v2 - name: GitHub CLI example run: gh issue list env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
I understand that this has to be better documented; I'll add a label as a TODO item for us. Thanks for your ask!
Reacted by Yogesh Agarwal, Allie, Michael Fridman, Andreas Nel, Eddú Meléndez Gonzales, Jesse Glick, Pat Myron and Fujita HitoshiReacted by Aaron ("AJ") Steers, Michael Fridman, Derek Ardolf and Pranav SinghReacted by Aaron ("AJ") Steers and Nimrod Becker@mislav - Awesome. That's a big help.
When version 1.0.0 could be included in github actions? I'm looking forward to use new feature of gh.
Reacted by Rubens Mariuzzo@trim21 It usually doesn't take too long! In the meantime you can always download the binary directly from releases via a script.
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
Reacted by Aaron ("AJ") SteersReacted by Aaron ("AJ") SteersGreat 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.@happiness801 Something like:
# Linux wget -O- https://github.com/cli/cli/releases/download/v1.0.0/gh_1.0.0_linux_amd64.tar.gz | tar -xz --strip-components 1 --wildcards -- \*/bin/gh # macOS curl -fsSL https://github.com/cli/cli/releases/download/v1.0.0/gh_1.0.0_macOS_amd64.tar.gz | tar -xz --strip-components 1 -- \*/bin/gh
You will then be able to invoke
bin/ghin the current directory.- addedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributors
on Oct 7, 2020
Describe the feature or problem you’d like to solve
I'd like to be able to run
ghcli 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.