Skip to content

Commit 883426d

Browse files
committed
Simplify expression in container conditional steps of build workflow
The "Arduino IDE" GitHub Actions workflow uses a Docker container for the build job of certain target, while running others directly in the runner environment. Due to differences between these two environments, some steps must run only when a container is used by the job, and others only when the job is running in the runner environment. This is done by a conditional on the job matrix data regarding the container. The container value is set to null for the jobs that run in the runner environment, while containing a full container configuration mapping for the jobs that run in a container. Previously the conditional unnecessarily used the value of the image key of the container object specifically. The comparison can be done against the container value itself. Doing this will make it a little easier to understand the workflow code, since the conditional more clearly reflects the matrix (where `container` is set to `null` instead of `container.image`).
1 parent 97b0bc0 commit 883426d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: .github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,24 @@ jobs:
284284

285285
steps:
286286
- name: Checkout
287-
if: fromJSON(matrix.config.container).image == null
287+
if: fromJSON(matrix.config.container) == null
288288
uses: actions/checkout@v4
289289

290290
- name: Checkout
291291
# actions/checkout@v4 has dependency on a higher version of glibc than available in the Linux container.
292-
if: fromJSON(matrix.config.container).image != null
292+
if: fromJSON(matrix.config.container) != null
293293
uses: actions/checkout@v3
294294

295295
- name: Install Node.js
296-
if: fromJSON(matrix.config.container).image == null
296+
if: fromJSON(matrix.config.container) == null
297297
uses: actions/setup-node@v3
298298
with:
299299
node-version: ${{ env.NODE_VERSION }}
300300
registry-url: 'https://registry.npmjs.org'
301301
cache: 'yarn'
302302

303303
- name: Install Python 3.x
304-
if: fromJSON(matrix.config.container).image == null
304+
if: fromJSON(matrix.config.container) == null
305305
uses: actions/setup-python@v4
306306
with:
307307
python-version: '3.11.x'

0 commit comments

Comments
 (0)