fix(github-cli): install binary-only extensions correctly - #1715
fix(github-cli): install binary-only extensions correctly#1715Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes GitHub CLI extension installation in the github-cli devcontainer feature so binary-only extensions (e.g., github/gh-aw) are installed correctly via gh extension install, while preserving a git-clone fallback for extensions that can’t be installed through gh.
Changes:
- Switch extension installation to prefer
gh extension install, falling back to a shallowgit cloneon failure. - Extend the root-only
gh extension listwrapper to recognize manifest-based (binary) extensions. - Add a regression scenario/test that installs
github/gh-awand validates it runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/github-cli/scenarios.json | Adds github/gh-aw to the extensions scenario matrix. |
| test/github-cli/install_extensions.sh | Adds a runtime check for the gh aw extension. |
| src/github-cli/scripts/install-extensions.sh | Installs extensions via gh, retains git fallback, and updates the extension-list wrapper to handle manifest-based installs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/github-cli/scripts/install-extensions.sh:35
install_extensionchecks for an existing install using${extensions_root}/${repo_name}(e.g.,.../gh-aw), butgh extension install OWNER/gh-fooinstalls into a directory with thegh-prefix stripped (e.g.,.../foo). That means an already-installed binary extension can be missed by the guard, causinggh extension installto fail with “already installed” and then triggering the git-clone fallback into a second directory. Consider normalizing the extension directory name (strip a leadinggh-) for the guard and the git-clone fallback, and optionally clean up a partially-created directory after a failedgh extension installso the fallback clone can succeed.
extensions_root="${XDG_DATA_HOME:-"${HOME}/.local/share"}/gh/extensions"
repo_name="${extension##*/}"
mkdir -p "${extensions_root}"
if [ ! -d "${extensions_root}/${repo_name}" ]; then
if ! gh extension install "${extension}"; then
git \
-c credential.helper= \
-c credential.helper='!gh auth git-credential' \
clone --depth 1 "https://github.com/${extension}.git" "${extensions_root}/${repo_name}"
fi
fi
Summary
Fixes
github-cliextension installation for binary-only extensions such asgithub/gh-aw.Changes
gh extension installso GitHub CLI downloads release binaries when required.gh, includinggithub/gh-copilot.gh extension listcompatibility wrapper.github/gh-awand runsgh aw version.Validation