Skip to content

Commit 6cade09

Browse files
lpcoxCopilot
andcommitted
fix(workflows): fix silent curl pipe failure in gh-aw install step
The 'Install gh-aw extension' step used `curl ... | bash` which silently swallows curl failures — when curl can't download the install script (e.g., transient network issue), bash receives empty input and exits 0, leaving the gh-aw binary not installed. This caused intermittent 'Failed to find gh-aw binary for MCP server' errors in the claude/copilot token analyzer and optimizer workflows. Fix: download the install script to a temp file first, then execute it. This way a curl failure propagates correctly through bash's `set -e`. Also remove the `-type f` restriction from the binary search so symlinks are found, and use $HOME instead of ~/ to ensure reliable expansion. Fixes #2141 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2549b72 commit 6cade09

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/claude-token-optimizer.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/claude-token-usage-analyzer.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/copilot-token-optimizer.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/copilot-token-usage-analyzer.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/shared/mcp/gh-aw.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ steps:
1414
# Install gh-aw if not already available
1515
if ! gh aw --version >/dev/null 2>&1; then
1616
echo "Installing gh-aw extension..."
17-
curl -fsSL https://raw.githubusercontent.com/github/gh-aw/refs/heads/main/install-gh-aw.sh | bash
17+
# Download to a temp file first so curl failures are detected (avoids silent pipe failure)
18+
curl -fsSL https://raw.githubusercontent.com/github/gh-aw/refs/heads/main/install-gh-aw.sh -o /tmp/install-gh-aw.sh
19+
bash /tmp/install-gh-aw.sh
20+
rm -f /tmp/install-gh-aw.sh
1821
fi
1922
gh aw --version
2023
# Copy the gh-aw binary to RUNNER_TEMP for MCP server containerization
2124
mkdir -p "${RUNNER_TEMP}/gh-aw"
22-
GH_AW_BIN=$(which gh-aw 2>/dev/null || find ~/.local/share/gh/extensions/gh-aw -name 'gh-aw' -type f 2>/dev/null | head -1)
25+
GH_AW_BIN=$(which gh-aw 2>/dev/null || find "${HOME}/.local/share/gh/extensions/gh-aw" -name 'gh-aw' 2>/dev/null | head -1)
2326
if [ -n "$GH_AW_BIN" ] && [ -f "$GH_AW_BIN" ]; then
2427
cp "$GH_AW_BIN" "${RUNNER_TEMP}/gh-aw/gh-aw"
2528
chmod +x "${RUNNER_TEMP}/gh-aw/gh-aw"

0 commit comments

Comments
 (0)