Skip to content

fix(github-cli): install binary-only extensions correctly - #1715

Open
Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
devcontainers:mainfrom
V-Subhankar-infy:temp1
Open

fix(github-cli): install binary-only extensions correctly#1715
Venkumahanti Subhankar (V-Subhankar-infy) wants to merge 3 commits into
devcontainers:mainfrom
V-Subhankar-infy:temp1

Conversation

@V-Subhankar-infy

Copy link
Copy Markdown
Member

Summary

Fixes github-cli extension installation for binary-only extensions such as github/gh-aw.

Changes

  • Install extensions with gh extension install so GitHub CLI downloads release binaries when required.
  • Keep the existing directory guard to avoid overwriting installed extensions.
  • Fall back to the prior shallow clone for extensions that cannot be installed through gh, including github/gh-copilot.
  • Recognize manifest-based binary extensions in the gh extension list compatibility wrapper.
  • Add a regression test that installs github/gh-aw and runs gh aw version.

Validation

devcontainer features test -p . -f github-cli --skip-autogenerated --skip-duplicated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 shallow git clone on failure.
  • Extend the root-only gh extension list wrapper to recognize manifest-based (binary) extensions.
  • Add a regression scenario/test that installs github/gh-aw and 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.

Comment thread test/github-cli/install_extensions.sh
Comment thread src/github-cli/scripts/install-extensions.sh

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_extension checks for an existing install using ${extensions_root}/${repo_name} (e.g., .../gh-aw), but gh extension install OWNER/gh-foo installs into a directory with the gh- prefix stripped (e.g., .../foo). That means an already-installed binary extension can be missed by the guard, causing gh extension install to fail with “already installed” and then triggering the git-clone fallback into a second directory. Consider normalizing the extension directory name (strip a leading gh-) for the guard and the git-clone fallback, and optionally clean up a partially-created directory after a failed gh extension install so 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

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.

[github-cli] cannot install binary-only extensions such as github/gh-aw

2 participants