From 255a149f4573fe66e4a4969c9ad26e5c0045814a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 15:55:53 +0000 Subject: [PATCH 1/5] Initial plan From 450ada0949690dd2d544ebf6afc4cd627bc66a2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 16:04:59 +0000 Subject: [PATCH 2/5] Fix setup-cli action to validate installed version matches requested 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> --- actions/setup-cli/install_test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/actions/setup-cli/install_test.sh b/actions/setup-cli/install_test.sh index d9773bee4a0..86b851994d7 100755 --- a/actions/setup-cli/install_test.sh +++ b/actions/setup-cli/install_test.sh @@ -109,6 +109,20 @@ test_checksum_validation() { fi } +# Test 7: Verify version mismatch detection after gh extension install +test_version_mismatch_detection() { + echo "" + echo "Test 7: Verify version mismatch detection after gh extension install" + + # Check if script detects when installed version differs from requested version + 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" + else + print_result "Script missing version mismatch detection (gh extension install may install wrong version)" "FAIL" + fi +} + # Run all tests echo "=========================================" echo "Testing setup-cli action install.sh" @@ -120,6 +134,7 @@ test_input_version test_gh_install test_version_pinning test_checksum_validation +test_version_mismatch_detection # Summary echo "" From 90307afaeea43cfd9638becb83e29039266506dd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 16:05:55 +0000 Subject: [PATCH 3/5] Fix setup-cli action to validate installed version matches requested 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> --- actions/setup-cli/install.sh | 21 ++++++++++++++------- install-gh-aw.sh | 21 ++++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/actions/setup-cli/install.sh b/actions/setup-cli/install.sh index 58d73c6805d..cd7a8c13466 100755 --- a/actions/setup-cli/install.sh +++ b/actions/setup-cli/install.sh @@ -253,15 +253,22 @@ if [ "$TRY_GH_INSTALL" = true ] && command -v gh &> /dev/null; then # Verify the installation succeeded if gh aw version &> /dev/null; then 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 + 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 - - exit 0 else print_warning "gh extension install completed but verification failed" print_info "Falling back to manual installation..." diff --git a/install-gh-aw.sh b/install-gh-aw.sh index 58d73c6805d..cd7a8c13466 100755 --- a/install-gh-aw.sh +++ b/install-gh-aw.sh @@ -253,15 +253,22 @@ if [ "$TRY_GH_INSTALL" = true ] && command -v gh &> /dev/null; then # Verify the installation succeeded if gh aw version &> /dev/null; then 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 + 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 - - exit 0 else print_warning "gh extension install completed but verification failed" print_info "Falling back to manual installation..." From 7a3268b8d4a8c71da1964aa2c93027cf0e271f3e Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Sun, 8 Mar 2026 16:11:44 +0000 Subject: [PATCH 4/5] Update install-gh-aw.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install-gh-aw.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/install-gh-aw.sh b/install-gh-aw.sh index cd7a8c13466..8b3d322f685 100755 --- a/install-gh-aw.sh +++ b/install-gh-aw.sh @@ -254,20 +254,26 @@ if [ "$TRY_GH_INSTALL" = true ] && command -v gh &> /dev/null; then if gh aw version &> /dev/null; then INSTALLED_VERSION=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) - # 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..." + # Ensure we could parse an installed version; empty means verification failed + 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 - 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" ] && [ "$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 - - exit 0 fi else print_warning "gh extension install completed but verification failed" From b093f060c99feee6018a06dc6ea648cf638ef0e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 16:19:01 +0000 Subject: [PATCH 5/5] Fix non-portable grep in install_test.sh: use separate grep -q checks instead of BRE alternation with backslash-pipe Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup-cli/install.sh | 30 ++++++++++++++++++------------ actions/setup-cli/install_test.sh | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/actions/setup-cli/install.sh b/actions/setup-cli/install.sh index cd7a8c13466..8b3d322f685 100755 --- a/actions/setup-cli/install.sh +++ b/actions/setup-cli/install.sh @@ -254,20 +254,26 @@ if [ "$TRY_GH_INSTALL" = true ] && command -v gh &> /dev/null; then if gh aw version &> /dev/null; then INSTALLED_VERSION=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) - # 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..." + # Ensure we could parse an installed version; empty means verification failed + 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 - 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" ] && [ "$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 - - exit 0 fi else print_warning "gh extension install completed but verification failed" diff --git a/actions/setup-cli/install_test.sh b/actions/setup-cli/install_test.sh index 86b851994d7..8a22eb09052 100755 --- a/actions/setup-cli/install_test.sh +++ b/actions/setup-cli/install_test.sh @@ -115,7 +115,7 @@ test_version_mismatch_detection() { echo "Test 7: Verify version mismatch detection after gh extension install" # Check if script detects when installed version differs from requested version - if grep -q 'INSTALLED_VERSION.*!=.*VERSION\|VERSION.*!=.*INSTALLED_VERSION' "$SCRIPT_PATH" && \ + if grep -q 'INSTALLED_VERSION.*!=.*VERSION' "$SCRIPT_PATH" && \ grep -q 'Version mismatch' "$SCRIPT_PATH"; then print_result "Script detects version mismatch after gh extension install" "PASS" else