Skip to content

fix: migrate version-pinning fix to source file install-gh-aw.sh#19686

Merged
pelikhan merged 2 commits intomainfrom
copilot/migrate-install-sh-updates
Mar 5, 2026
Merged

fix: migrate version-pinning fix to source file install-gh-aw.sh#19686
pelikhan merged 2 commits intomainfrom
copilot/migrate-install-sh-updates

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

PR #19609 applied a version-pinning fix directly to actions/setup-cli/install.sh (the copy) rather than install-gh-aw.sh (the source). Because make sync-action-scripts copies install-gh-aw.shactions/setup-cli/install.sh, the fix was subsequently overwritten, leaving setup-cli still installing the latest version regardless of the version input.

Changes

  • install-gh-aw.sh — applied the version-pinning fix from PR [WIP] Rewrite changes and review tests from pull request 19591 #19609:

    • Pass --pin "$VERSION" to gh extension install when a specific version is requested
    • Use ${PIPESTATUS[0]} to capture the exit code of gh extension install (not tee)
    • Output ${INSTALLED_VERSION} (actual installed version) instead of ${VERSION} (user input) to GITHUB_OUTPUT
  • actions/setup-cli/install.sh — re-synced from source via make sync-action-scripts

# Before: always installs latest regardless of $VERSION
if gh extension install "$REPO" --force 2>&1 | tee /tmp/gh-install.log; then

# After: pins to requested version when one is specified
install_result=0
if [ -n "$VERSION" ] && [ "$VERSION" != "latest" ]; then
    gh extension install "$REPO" --force --pin "$VERSION" 2>&1 | tee /tmp/gh-install.log
    install_result=${PIPESTATUS[0]}
else
    gh extension install "$REPO" --force 2>&1 | tee /tmp/gh-install.log
    install_result=${PIPESTATUS[0]}
fi

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/repos/github/gh-aw/commits
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

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

Original prompt

Make sure that the updates that were applied to actions/setuo-cli/install.sh are migrated to their source file. These changes should
Have been made on the source file since there is a copy stage.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…sync to setup-cli action

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate updates from install.sh to source file fix: migrate version-pinning fix to source file install-gh-aw.sh Mar 5, 2026
@pelikhan pelikhan marked this pull request as ready for review March 5, 2026 04:23
Copilot AI review requested due to automatic review settings March 5, 2026 04:23
@pelikhan pelikhan merged commit c35ab22 into main Mar 5, 2026
104 checks passed
@pelikhan pelikhan deleted the copilot/migrate-install-sh-updates branch March 5, 2026 04:23
Copy link
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

Migrates the version-pinning fix for gh extension install from the generated action script back into the source installer script so it won’t be overwritten by make sync-action-scripts.

Changes:

  • Update gh extension install path to pass --pin "$VERSION" when a specific version is requested, and capture gh’s exit code via PIPESTATUS.
  • Fix GitHub Actions output to write the actual installed version (INSTALLED_VERSION) instead of the requested input.
  • Re-sync actions/setup-cli/install.sh from install-gh-aw.sh.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
install-gh-aw.sh Applies version-pinning + correct exit-code/output handling in the source installer.
actions/setup-cli/install.sh Re-generated copy of the installer with the same fixes for the action.

💡 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.

Comment on lines +242 to +252
# Call gh extension install directly to avoid command injection
install_result=0
if [ -n "$VERSION" ] && [ "$VERSION" != "latest" ]; then
gh extension install "$REPO" --force --pin "$VERSION" 2>&1 | tee /tmp/gh-install.log
install_result=${PIPESTATUS[0]}
else
gh extension install "$REPO" --force 2>&1 | tee /tmp/gh-install.log
install_result=${PIPESTATUS[0]}
fi

if [ $install_result -eq 0 ]; then
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Because the script runs with set -e, the gh extension install ... | tee /tmp/gh-install.log pipeline being executed as a standalone command can cause the whole script to exit immediately if tee fails (e.g., unwritable/missing /tmp), which would skip the intended fallback to manual installation. Previously the pipeline ran inside an if ...; then condition, which avoids set -e termination.

Consider temporarily disabling errexit around the pipeline (or putting the pipeline back in an if conditional) so you can reliably capture ${PIPESTATUS[0]} and continue to the fallback path even when the pipeline itself returns non-zero.

Copilot uses AI. Check for mistakes.
Comment on lines +242 to +252
# Call gh extension install directly to avoid command injection
install_result=0
if [ -n "$VERSION" ] && [ "$VERSION" != "latest" ]; then
gh extension install "$REPO" --force --pin "$VERSION" 2>&1 | tee /tmp/gh-install.log
install_result=${PIPESTATUS[0]}
else
gh extension install "$REPO" --force 2>&1 | tee /tmp/gh-install.log
install_result=${PIPESTATUS[0]}
fi

if [ $install_result -eq 0 ]; then
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Because the script runs with set -e, the gh extension install ... | tee /tmp/gh-install.log pipeline being executed as a standalone command can cause the whole script to exit immediately if tee fails (e.g., unwritable/missing /tmp), which would skip the intended fallback to manual installation. Previously the pipeline ran inside an if ...; then condition, which avoids set -e termination.

Consider temporarily disabling errexit around the pipeline (or putting the pipeline back in an if conditional) so you can reliably capture ${PIPESTATUS[0]} and continue to the fallback path even when the pipeline itself returns non-zero.

Copilot uses AI. Check for mistakes.
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