|
| 1 | +--- |
| 2 | +# gh-aw Extension - Shared Component |
| 3 | +# Installs the gh-aw CLI extension and copies the binary |
| 4 | +# for MCP server containerization. |
| 5 | +# |
| 6 | +# This component replaces the compiler-generated "Install gh-aw extension" |
| 7 | +# step with a robust installation that handles pre-installed binaries |
| 8 | +# (e.g., from copilot-setup-steps.yml curl-based installs). |
| 9 | +# |
| 10 | +# Usage: |
| 11 | +# imports: |
| 12 | +# - uses: shared/mcp/gh-aw.md |
| 13 | + |
| 14 | +steps: |
| 15 | + - name: Install gh-aw extension |
| 16 | + env: |
| 17 | + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 18 | + run: | |
| 19 | + # Install gh-aw if not already available |
| 20 | + if ! gh aw --version >/dev/null 2>&1; then |
| 21 | + echo "Installing gh-aw extension..." |
| 22 | + curl -fsSL https://raw.githubusercontent.com/github/gh-aw/refs/heads/main/install-gh-aw.sh | bash |
| 23 | + fi |
| 24 | + gh aw --version |
| 25 | + # Copy the gh-aw binary to ${RUNNER_TEMP}/gh-aw for MCP server containerization |
| 26 | + mkdir -p "${RUNNER_TEMP}/gh-aw" |
| 27 | + GH_AW_BIN="" |
| 28 | + GH_AW_BIN=$(command -v gh-aw 2>/dev/null) || true |
| 29 | + if [ -z "$GH_AW_BIN" ]; then |
| 30 | + GH_AW_BIN=$(find "${HOME}/.local/share/gh/extensions/gh-aw" -name 'gh-aw' -type f 2>/dev/null | head -1) || true |
| 31 | + fi |
| 32 | + if [ -n "$GH_AW_BIN" ] && [ -f "$GH_AW_BIN" ]; then |
| 33 | + cp "$GH_AW_BIN" "${RUNNER_TEMP}/gh-aw/gh-aw" |
| 34 | + chmod +x "${RUNNER_TEMP}/gh-aw/gh-aw" |
| 35 | + echo "Copied gh-aw binary to ${RUNNER_TEMP}/gh-aw/gh-aw" |
| 36 | + else |
| 37 | + echo "::error::Failed to find gh-aw binary for MCP server" |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | +--- |
0 commit comments