Skip to content

Commit f5fd393

Browse files
committed
fix: create Windows-compatible codeql.cmd wrapper
On Windows, gh codeql install-stub creates a bash script (codeql) which is not discoverable by Node.js child_process.spawn(). This causes 'spawn codeql ENOENT' errors in integration tests. Add a step that creates a codeql.cmd wrapper delegating to 'gh codeql' so that spawn('codeql', ...) resolves correctly on Windows. Aligns with github/gh-codeql#21 which adds native Windows support to install-stub. This workaround can be removed once that PR is merged.
1 parent 74c71a3 commit f5fd393

File tree

1 file changed

+17
-0
lines changed
  • .github/actions/setup-codeql-environment

1 file changed

+17
-0
lines changed

.github/actions/setup-codeql-environment/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ runs:
149149
150150
echo "✅ GitHub CLI CodeQL extension installed successfully"
151151
152+
# On Windows, gh codeql install-stub creates a bash script which is not
153+
# discoverable by Node.js child_process.spawn(). Create a .cmd wrapper
154+
# so that tools using spawn('codeql', ...) can find the CodeQL CLI.
155+
- name: Create Windows-compatible CodeQL CLI wrapper
156+
if: runner.os == 'Windows'
157+
shell: bash
158+
run: |
159+
CODEQL_STUB_DIR="$HOME/.local/bin"
160+
161+
cat > "$CODEQL_STUB_DIR/codeql.cmd" << 'WRAPPER'
162+
@echo off
163+
gh codeql %*
164+
exit /b %errorlevel%
165+
WRAPPER
166+
167+
echo "✅ Created Windows-compatible CodeQL CLI wrapper at $CODEQL_STUB_DIR/codeql.cmd"
168+
152169
- name: Setup CodeQL environment variables
153170
id: setup-codeql-env
154171
shell: bash

0 commit comments

Comments
 (0)