Add gh CLI install step for custom image runner in all workflows using gh#23426
Add gh CLI install step for custom image runner in all workflows using gh#23426
Conversation
Step 11 'Fetch issues data' was failing on aw-gpu-runner-T4 because gh CLI is not installed on that custom image. Add install_gh_cli.sh script and an 'Install gh CLI' step in shared/issues-data-fetch.md that runs before 'Fetch issues data' to ensure gh is available. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/a9450aa5-43a9-49fc-aae9-0d2e2b623b1d Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an installation step to ensure the GitHub CLI (gh) is available when running the issues data fetch workflow on custom runner images that don’t ship with gh.
Changes:
- Introduces an idempotent Debian/Ubuntu
apt-based installer script forgh. - Inserts an “Install gh CLI” step before “Fetch issues data” in the shared workflow fragment.
- Regenerates workflow lock files to reflect the new step ordering/content.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| actions/setup/sh/install_gh_cli.sh | New script to install gh via the official GitHub CLI apt repository if missing. |
| .github/workflows/shared/issues-data-fetch.md | Adds a pre-step to install gh before invoking gh issue list. |
| .github/workflows/daily-issues-report.lock.yml | Lockfile regeneration reflecting the new install step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| exit 1 | ||
| fi | ||
|
|
||
| # Update package lists once (also installs curl if missing) |
There was a problem hiding this comment.
The comment says "Update package lists once (also installs curl if missing)", but apt-get update does not install curl; curl is installed in the subsequent block. Please adjust the comment to avoid misleading future readers.
| # Update package lists once (also installs curl if missing) | |
| # Update package lists before installing packages |
| echo "Updating package lists..." | ||
| sudo apt-get update -qq | ||
|
|
||
| # Install curl if missing (needed to fetch the signing key) | ||
| if ! command -v curl &>/dev/null; then | ||
| echo "curl not found, installing..." | ||
| sudo apt-get install -y curl | ||
| fi | ||
|
|
||
| # Add the GitHub CLI apt repository | ||
| KEYRING_PATH="/usr/share/keyrings/githubcli-archive-keyring.gpg" | ||
| SOURCE_LIST="/etc/apt/sources.list.d/github-cli.list" | ||
|
|
||
| echo "Adding GitHub CLI apt repository..." | ||
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \ | ||
| | sudo dd of="${KEYRING_PATH}" | ||
| sudo chmod go+r "${KEYRING_PATH}" | ||
|
|
||
| echo "deb [arch=$(dpkg --print-architecture) signed-by=${KEYRING_PATH}] https://cli.github.com/packages stable main" \ | ||
| | sudo tee "${SOURCE_LIST}" > /dev/null | ||
|
|
||
| sudo apt-get update -qq | ||
| sudo apt-get install -y gh |
There was a problem hiding this comment.
This script calls sudo unconditionally for apt-get, dd, chmod, and tee. On custom images that run as root (or images that don't include sudo), this will fail even though the operations could succeed. Consider detecting whether sudo is available / needed (e.g., use SUDO=sudo when present and SUDO= when running as root), and use that wrapper for privileged commands.
- daily-news.md: add Install gh CLI step (uses aw-gpu-runner-T4 directly with gh api) - shared/weekly-issues-data-fetch.md: add Install gh CLI step - shared/discussions-data-fetch.md: add Install gh CLI step - shared/copilot-pr-data-fetch.md: add Install gh CLI step - shared/copilot-session-data-fetch.md: add Install gh CLI step Recompile updates 9 lock files that now include the install step. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f33615e2-eb33-4a0e-8fcc-64fb59737081 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit
Recompiling updated 9 lock files in total (the shared files are imported by multiple workflows). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
aw-gpu-runner-T4is a custom image that doesn't includeghCLI, causing any step that callsghto fail immediately.Changes
actions/setup/sh/install_gh_cli.sh— Idempotent script that installsghvia the official GitHub CLI apt repository on Debian/Ubuntu. No-ops ifghis already present, so it's safe on standard hosted runners too.shared/issues-data-fetch.md— Adds an "Install gh CLI" step immediately before "Fetch issues data".daily-news.md— Adds an "Install gh CLI" step as the first step (directly usesgh apionaw-gpu-runner-T4).shared/weekly-issues-data-fetch.md— Adds an "Install gh CLI" step before "Fetch weekly issues data".shared/discussions-data-fetch.md— Adds an "Install gh CLI" step before "Fetch discussions data".shared/copilot-pr-data-fetch.md— Adds an "Install gh CLI" step before "Fetch Copilot PR data".shared/copilot-session-data-fetch.md— Adds an "Install gh CLI" step before "Fetch Copilot session data".⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.