Skip to content

Commit 765f57f

Browse files
committed
fix: install CLI from cloned SDK to match test harness version
The build was failing because we were installing the latest @github/copilot CLI globally, but the test harness in the official SDK is designed for a specific CLI version locked in nodejs/package-lock.json. This change: - Moves CLI installation to after the SDK is cloned (mvn compile) - Installs the CLI from the cloned SDK's nodejs directory using 'npm ci' - Uses the same installation pattern as the official SDK's workflow This ensures version compatibility between the CLI and test harness.
1 parent f81ab05 commit 765f57f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/build-test.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ jobs:
2727
shell: bash
2828
steps:
2929
- uses: actions/checkout@v6
30-
- id: setup-copilot
31-
uses: ./.github/actions/setup-copilot
30+
- uses: actions/setup-node@v6
31+
with:
32+
node-version: 22
3233
- uses: actions/setup-java@v5
3334
with:
3435
java-version: "17"
@@ -43,15 +44,26 @@ jobs:
4344
fi
4445
echo "✅ spotless:check passed"
4546
46-
- name: Build SDK
47+
- name: Build SDK and clone test harness
4748
run: mvn compile
4849

50+
- name: Install Copilot CLI from cloned SDK
51+
id: setup-copilot
52+
run: |
53+
# Install dependencies in the cloned SDK's nodejs directory
54+
# This ensures we use the same CLI version as the test harness expects
55+
npm --prefix target/copilot-sdk/nodejs ci --ignore-scripts
56+
echo "path=$(pwd)/target/copilot-sdk/nodejs/node_modules/@github/copilot/index.js" >> $GITHUB_OUTPUT
57+
58+
- name: Verify CLI works
59+
run: node ${{ steps.setup-copilot.outputs.path }} --version
60+
4961
- name: Run Java SDK tests
5062
env:
5163
# Set CI=false to bypass a JSON parsing bug in the upstream SDK test harness
5264
# (replayingCapiProxy.ts:260-266 emitNoMatchingRequestWarning with empty body)
5365
# This can be removed once the upstream issue is fixed.
5466
CI: "false"
5567
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
56-
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }}
68+
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }}
5769
run: mvn verify

0 commit comments

Comments
 (0)