Skip to content

Commit 93a6283

Browse files
per1234cmaglie
authored andcommitted
Control Node.js version used in relevant GitHub Actions workflows
The GitHub Actions workflows have tool dependencies sourced from npm. Previously, the workflows were not configured to set up a specific version of Node.js, which caused the default version from the GitHub Actions runner to be used. That version might be changed at any time, which left the workflows vulnerable to breakage. Setting a specific version of Node.js provides stability. Updates to the version can be made in a controlled manner, with validation before the workflow goes into production use. The version is set via an environment variable at the top of the workflow in order to facilitate updates.
1 parent 679bbae commit 93a6283

5 files changed

+57
-4
lines changed

.github/workflows/check-markdown-task.yml

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md
22
name: Check Markdown
33

4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
48
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
59
on:
610
push:
@@ -37,6 +41,11 @@ jobs:
3741
- name: Checkout repository
3842
uses: actions/checkout@v2
3943

44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: ${{ env.NODE_VERSION }}
48+
4049
- name: Initialize markdownlint-cli problem matcher
4150
uses: xt0rted/markdownlint-problem-matcher@v1
4251

@@ -56,6 +65,11 @@ jobs:
5665
- name: Checkout repository
5766
uses: actions/checkout@v2
5867

68+
- name: Setup Node.js
69+
uses: actions/setup-node@v3
70+
with:
71+
node-version: ${{ env.NODE_VERSION }}
72+
5973
- name: Install Task
6074
uses: arduino/setup-task@v1
6175
with:

.github/workflows/check-prettier-formatting-task.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
22
name: Check Prettier Formatting
33

4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
48
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
59
on:
610
push:
@@ -206,6 +210,11 @@ jobs:
206210
- name: Checkout repository
207211
uses: actions/checkout@v2
208212

213+
- name: Setup Node.js
214+
uses: actions/setup-node@v3
215+
with:
216+
node-version: ${{ env.NODE_VERSION }}
217+
209218
- name: Install Task
210219
uses: arduino/setup-task@v1
211220
with:

.github/workflows/check-taskfiles.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
22
name: Check Taskfiles
33

4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
48
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
59
on:
610
push:
@@ -37,6 +41,11 @@ jobs:
3741
- name: Checkout repository
3842
uses: actions/checkout@v2
3943

44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: ${{ env.NODE_VERSION }}
48+
4049
- name: Download JSON schema for Taskfiles
4150
id: download-schema
4251
uses: carlosperate/download-file-action@v1

.github/workflows/check-workflows-task.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/master/workflow-templates/check-workflows-task.md
22
name: Check Workflows
33

4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
48
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
59
on:
610
push:
@@ -25,6 +29,11 @@ jobs:
2529
- name: Checkout repository
2630
uses: actions/checkout@v2
2731

32+
- name: Setup Node.js
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: ${{ env.NODE_VERSION }}
36+
2837
- name: Install Task
2938
uses: arduino/setup-task@v1
3039
with:

.github/workflows/sync-labels.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
22
name: Sync Labels
33

4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
CONFIGURATIONS_FOLDER: .github/label-configuration-files
8+
CONFIGURATIONS_ARTIFACT: label-configuration-files
9+
410
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
511
on:
612
push:
@@ -17,10 +23,6 @@ on:
1723
workflow_dispatch:
1824
repository_dispatch:
1925

20-
env:
21-
CONFIGURATIONS_FOLDER: .github/label-configuration-files
22-
CONFIGURATIONS_ARTIFACT: label-configuration-files
23-
2426
jobs:
2527
check:
2628
runs-on: ubuntu-latest
@@ -29,6 +31,11 @@ jobs:
2931
- name: Checkout repository
3032
uses: actions/checkout@v2
3133

34+
- name: Setup Node.js
35+
uses: actions/setup-node@v3
36+
with:
37+
node-version: ${{ env.NODE_VERSION }}
38+
3239
- name: Download JSON schema for labels configuration file
3340
id: download-schema
3441
uses: carlosperate/download-file-action@v1
@@ -118,6 +125,11 @@ jobs:
118125
with:
119126
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
120127

128+
- name: Setup Node.js
129+
uses: actions/setup-node@v3
130+
with:
131+
node-version: ${{ env.NODE_VERSION }}
132+
121133
- name: Merge label configuration files
122134
run: |
123135
# Merge all configuration files

0 commit comments

Comments
 (0)