-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Invocation of gh
client results in "command not found"
#2641
Comments
tags that would contain gh, your selected image does not ship gh
If you really want avoid program not found download the full image, it's almost a 1 : 1 snapshot of the GitHub Hosted Runners, but this one is big use |
@ChristopherHX Thanks for your response. It seems that I was mistaken regarding this script: https://github.com/catthehacker/docker_images/blob/master/linux/ubuntu/scripts/gh.sh . I thought it was executed as part of all ubuntu-based image builds: https://github.com/catthehacker/docker_images/blob/844d48050c644ed19d504d10f63cf91ba196c6a1/linux/ubuntu/Dockerfile#L25 |
Another solution to this is, to add a step installing the GitHub CLI name: 'install_gh_cli'
description: 'Install the GitHub CLI'
runs:
using: "composite"
steps:
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
- name: Install GitHub CLI
shell: bash
if: ${{ env.ACT && runner.os == 'Linux' }}
run: |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
|
Discussed in #2639
Originally posted by socketbox January 29, 2025
In a job that uses the
ubuntu-latest
runner, I've got a step that calls the GitHub API with thegh
client, like so:However, the step fails when I run the workflow with the following command (I'm using the GitHub-extension-installed version of act):
gh act schedule -v -s GITHUB_TOKEN=github_pat_foo -W ./.github/workflows/npm-audit.yml
The full job looks like this:
Here's the error I receive with verbose output:
What's got me puzzled (among other things) is that the catthehacker runner images seem to contain
gh
: https://github.com/catthehacker/docker_images/blob/master/linux/ubuntu/scripts/gh.shUpdate: thinking it was possible that I was using a non-standard image for the runner, I logged in to GHCR and then ran
act
with the-P
flag:gh act schedule -P ubuntu-latest="ghcr.io/catthehacker/ubuntu:act-22.04" -v -s GITHUB_TOKEN=github_foo -W ./.github/workflows/npm-audit.yml
Still the same result. I also tried the20.04
image, thinking that it might have been removed in the22.04
image. No luck.Then I shelled into the pulled image and tried to find
gh
. Nothing:Versions:
The text was updated successfully, but these errors were encountered: