Uh oh!
There was an error while loading. Please reload this page.
Fix setup-cli action ignoring pinned version input - #20081
Conversation
…version When gh extension install ignores the --pin flag and installs the wrong version, the script now detects the mismatch and falls back to the manual binary download path which correctly installs the specified version. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…version When gh extension install ignores the --pin flag and installs the wrong version, the script now detects the mismatch and falls back to the manual binary download path which correctly installs the specified version. Fixes: install-gh-aw.sh (source of truth), synced to actions/setup-cli/install.sh Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ensures actions/setup-cli and the standalone installer don’t silently succeed with the wrong gh-aw version when gh extension install --pin is ignored for binary extensions.
Changes:
- Adds post-install version verification after
gh extension install, falling back to manual binary download on mismatch. - Updates the generated
actions/setup-cli/install.shin sync withinstall-gh-aw.sh. - Adds a shell test that checks the installer script contains version-mismatch detection logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| install-gh-aw.sh | Adds installed-vs-requested version check after gh extension install and falls back on mismatch. |
| actions/setup-cli/install.sh | Syncs the same version mismatch verification/fallback logic into the action’s installer. |
| actions/setup-cli/install_test.sh | Adds a grep-based test asserting version-mismatch detection exists in the installer script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Uh oh!
There was an error while loading. Please reload this page.
| INSTALLED_VERSION=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) | ||
| print_success "Successfully installed gh-aw using gh extension install" | ||
| print_info "Installed version: $INSTALLED_VERSION" | ||
| # Set output for GitHub Actions | ||
| if [ -n "${GITHUB_OUTPUT}" ]; then | ||
| echo "installed_version=${INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}" | ||
| # Verify the installed version matches the requested version (if specific version was requested) | ||
| if [ "$VERSION" != "latest" ] && [ -n "$INSTALLED_VERSION" ] && [ "$INSTALLED_VERSION" != "$VERSION" ]; then | ||
| print_warning "Version mismatch: requested $VERSION but gh extension install installed $INSTALLED_VERSION" | ||
| print_info "Falling back to manual installation to install the correct version..." | ||
| else |
There was a problem hiding this comment.
The mismatch check only triggers when INSTALLED_VERSION is non-empty. If gh aw version output changes or can’t be parsed by the grep -oE 'vX.Y.Z' pattern, INSTALLED_VERSION becomes empty and the script will treat the install as successful, write an empty installed_version output, and exit 0. To make the verification reliable, treat an empty/unparseable INSTALLED_VERSION as a verification failure (warn and fall back to manual install, or at least avoid exiting 0 with an empty output).
See below for a potential fix:
# Ensure we were able to parse a version string
if [ -z "$INSTALLED_VERSION" ]; then
print_warning "gh extension install completed but the installed gh-aw version could not be determined"
print_info "Falling back to manual installation..."
else
# Verify the installed version matches the requested version (if specific version was requested)
if [ "$VERSION" != "latest" ] && [ "$INSTALLED_VERSION" != "$VERSION" ]; then
print_warning "Version mismatch: requested $VERSION but gh extension install installed $INSTALLED_VERSION"
print_info "Falling back to manual installation to install the correct version..."
else
print_success "Successfully installed gh-aw using gh extension install"
print_info "Installed version: $INSTALLED_VERSION"
# Set output for GitHub Actions
if [ -n "${GITHUB_OUTPUT}" ]; then
echo "installed_version=${INSTALLED_VERSION}" >> "${GITHUB_OUTPUT}"
fi
exit 0
fi
| if grep -q 'INSTALLED_VERSION.*!=.*VERSION\|VERSION.*!=.*INSTALLED_VERSION' "$SCRIPT_PATH" && \ | ||
| grep -q 'Version mismatch' "$SCRIPT_PATH"; then | ||
| print_result "Script detects version mismatch after gh extension install" "PASS" |
There was a problem hiding this comment.
This test uses grep with \| alternation but without -E. \| is a GNU grep BRE extension and isn’t portable on macOS/BSD grep, which can make this test fail on non-Linux environments. Use grep -Eq '...|...' (ERE) or split into two separate grep -q checks for portability.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pelikhan
commented
Mar 8, 2026
@copilot review changes . Investigate how to pin a version with gh extensions install |
… instead of BRE alternation with backslash-pipe Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Investigated: The approach in this PR is the correct workaround:
The manual download path is deterministic — it fetches the exact asset for the requested version and platform. Also addressed two feedback items from the reviewer in commit
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
❌ Tool validation failed! Agent Container Smoke Test detected missing tools: failed |
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
Uh oh!
There was an error while loading. Please reload this page.
💫 TO BE CONTINUED...Smoke Claude failed! Our hero faces unexpected challenges... |
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
install-gh-aw.shto verify installed version matches requested version aftergh extension installINSTALLED_VERSIONas verification failure (falls back to manual install)make sync-action-scriptsto sync fix toactions/setup-cli/install.shinstall_test.shfor version mismatch detection\|BRE alternation in test 7 grep to use separategrep -qcalls✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.