fix: migrate version-pinning fix to source file install-gh-aw.sh#19686
fix: migrate version-pinning fix to source file install-gh-aw.sh#19686
Conversation
…sync to setup-cli action Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
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 installpath to pass--pin "$VERSION"when a specific version is requested, and capturegh’s exit code viaPIPESTATUS. - Fix GitHub Actions output to write the actual installed version (
INSTALLED_VERSION) instead of the requested input. - Re-sync
actions/setup-cli/install.shfrominstall-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.
| # 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 |
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
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.
PR #19609 applied a version-pinning fix directly to
actions/setup-cli/install.sh(the copy) rather thaninstall-gh-aw.sh(the source). Becausemake sync-action-scriptscopiesinstall-gh-aw.sh→actions/setup-cli/install.sh, the fix was subsequently overwritten, leavingsetup-clistill installing the latest version regardless of theversioninput.Changes
install-gh-aw.sh— applied the version-pinning fix from PR [WIP] Rewrite changes and review tests from pull request 19591 #19609:--pin "$VERSION"togh extension installwhen a specific version is requested${PIPESTATUS[0]}to capture the exit code ofgh extension install(nottee)${INSTALLED_VERSION}(actual installed version) instead of${VERSION}(user input) toGITHUB_OUTPUTactions/setup-cli/install.sh— re-synced from source viamake sync-action-scriptsWarning
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/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
💡 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.