Skip to content

Commit 3e0879f

Browse files
Copilotdata-douser
andauthored
fix: split setup-node into conditional steps to avoid empty node-version
actions/setup-node prioritizes node-version over node-version-file. When the matrix value is '.node-version', the previous expression set node-version to an empty string, which could cause the action to ignore node-version-file entirely. Split into two steps with if: guards so node-version is never set to an empty value. Fixes all instances across build-server.yml, build-and-test-extension.yml, and build-and-test-client.yml (integration-tests and codeql-path-tests jobs). Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
1 parent 91ac332 commit 3e0879f

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

.github/workflows/build-and-test-client.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,20 @@ jobs:
102102
cache-dependency-path: 'client/go.sum'
103103
go-version-file: 'client/go.mod'
104104

105-
- name: Setup Node.js environment
105+
- name: Setup Node.js environment (from .node-version)
106+
if: matrix.node == '.node-version'
106107
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
107108
with:
108109
cache: 'npm'
109-
node-version: ${{ matrix.node != '.node-version' && matrix.node || '' }}
110110
node-version-file: '.node-version'
111111

112+
- name: Setup Node.js environment (explicit version)
113+
if: matrix.node != '.node-version'
114+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
115+
with:
116+
cache: 'npm'
117+
node-version: ${{ matrix.node }}
118+
112119
- name: Install OS dependencies (Ubuntu)
113120
if: runner.os == 'Linux'
114121
run: sudo apt-get install -y jq
@@ -214,13 +221,20 @@ jobs:
214221
- name: Checkout repository
215222
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
216223

217-
- name: Setup Node.js
224+
- name: Setup Node.js (from .node-version)
225+
if: matrix.node == '.node-version'
218226
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
219227
with:
220228
cache: 'npm'
221-
node-version: ${{ matrix.node != '.node-version' && matrix.node || '' }}
222229
node-version-file: '.node-version'
223230

231+
- name: Setup Node.js (explicit version)
232+
if: matrix.node != '.node-version'
233+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
234+
with:
235+
cache: 'npm'
236+
node-version: ${{ matrix.node }}
237+
224238
- name: Install server dependencies
225239
run: npm ci --workspace=server
226240

.github/workflows/build-and-test-extension.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ jobs:
4141
- name: Checkout repository
4242
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4343

44-
- name: Setup Node.js environment
44+
- name: Setup Node.js environment (from .node-version)
45+
if: matrix.node == '.node-version'
4546
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
4647
with:
4748
cache: 'npm'
48-
node-version: ${{ matrix.node != '.node-version' && matrix.node || '' }}
4949
node-version-file: '.node-version'
5050

51+
- name: Setup Node.js environment (explicit version)
52+
if: matrix.node != '.node-version'
53+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
54+
with:
55+
cache: 'npm'
56+
node-version: ${{ matrix.node }}
57+
5158
- name: Install dependencies
5259
run: npm ci --include=optional --ignore-scripts
5360

.github/workflows/build-server.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ jobs:
3939
- name: Build Server - Checkout repository
4040
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4141

42-
- name: Build Server - Setup Node.js environment
42+
- name: Build Server - Setup Node.js environment (from .node-version)
43+
if: matrix.node == '.node-version'
4344
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
4445
with:
4546
cache: 'npm'
46-
node-version: ${{ matrix.node != '.node-version' && matrix.node || '' }}
4747
node-version-file: '.node-version'
4848

49+
- name: Build Server - Setup Node.js environment (explicit version)
50+
if: matrix.node != '.node-version'
51+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
52+
with:
53+
cache: 'npm'
54+
node-version: ${{ matrix.node }}
55+
4956
- name: Build Server - Install dependencies
5057
run: npm ci --include=optional --ignore-scripts
5158
working-directory: .

0 commit comments

Comments
 (0)