Skip to content

Add gh CLI install step for custom image runner in all workflows using gh#23426

Merged
pelikhan merged 2 commits intomainfrom
copilot/add-gh-cli-installation
Mar 29, 2026
Merged

Add gh CLI install step for custom image runner in all workflows using gh#23426
pelikhan merged 2 commits intomainfrom
copilot/add-gh-cli-installation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

aw-gpu-runner-T4 is a custom image that doesn't include gh CLI, causing any step that calls gh to fail immediately.

Changes

  • actions/setup/sh/install_gh_cli.sh — Idempotent script that installs gh via the official GitHub CLI apt repository on Debian/Ubuntu. No-ops if gh is 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 uses gh api on aw-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".
  • Lock files — All 178 workflow lock files recompiled; 9 lock files gain the new install step.

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

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>
@pelikhan pelikhan marked this pull request as ready for review March 29, 2026 10:55
Copilot AI review requested due to automatic review settings March 29, 2026 10:55
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

  • update all other agentic workflows using gh and this image runner

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for gh.
  • 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)
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# Update package lists once (also installs curl if missing)
# Update package lists before installing packages

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +55
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
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
- 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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 29, 2026

@copilot

  • update all other agentic workflows using gh and this image runner

Done in commit 422b49f. Added the "Install gh CLI" step to all other workflows that use gh CLI:

  • daily-news.md — directly uses gh api on aw-gpu-runner-T4
  • shared/weekly-issues-data-fetch.md — uses gh issue list / gh api
  • shared/discussions-data-fetch.md — uses gh api graphql
  • shared/copilot-pr-data-fetch.md — uses gh pr list / gh api
  • shared/copilot-session-data-fetch.md — uses gh api

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw shared/copilot-p-w shared/copilot-s-t shared/discussiosecurity ort.�� shared/gh.md layout-spec-main-d shared/issues-da168.63.129.16 shared/jqschema.git shared/pr-data-mcheckout shared/python-dacopilot/add-gh-cli-installation shared/reportingowner (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw shared/copilot-p-w shared/copilot-s-t shared/discussiosecurity shar�� shared/gh.md ort.md shared/issues-da168.63.129.16 shared/jqschema.git shared/pr-data-mcheckout shared/python-dacopilot/add-gh-cli-installation shared/reportingconntrack (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha flow\) safe-output-health.md dof$ (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .visibility ithub/workflows/shared/gh.md daily-issues-report.md ithub/workflows/shared/issues-da168.63.129.16 ithub/workflows/git ithub/workflows/-C ithub/workflows//home/REDACTED/work/gh-aw/gh-aw/.github/workflows ithub/workflows/rev-parse ithu�� ithub/workflows/shared/trends.mdINVALID,NEW ithub/workflows/weekly-blog-post-j r: $owner, name: $name) { hasDiscussionsEnabled } } user.name (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0 --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add gh CLI install step for custom image runner in issues-data-fetch Add gh CLI install step for custom image runner in all workflows using gh Mar 29, 2026
Copilot AI requested a review from pelikhan March 29, 2026 11:05
@pelikhan pelikhan merged commit c06a1e3 into main Mar 29, 2026
@pelikhan pelikhan deleted the copilot/add-gh-cli-installation branch March 29, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants