Skip to content

Commit

Permalink
Use engines.node as source of version data for actions/setup-node
Browse files Browse the repository at this point in the history
… action

The actions/setup-node GitHub Actions action is used to set up Node.js in the GitHub Actions runner machine.

The action supports obtaining the Node.js version to set up from the `engines.node` field of the package.json file.

This allows us to define the standardized version of Node.js for use by project contributors in a single place rather
than having to maintain multiple instances of that data.
  • Loading branch information
per1234 committed Oct 16, 2023
1 parent 0fd320b commit da8ef8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/check-npm-task.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-npm-task.md
name: Check npm

env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 18.x

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
create:
Expand Down Expand Up @@ -67,7 +63,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json

- name: Install Task
uses: arduino/setup-task@v1
Expand All @@ -92,7 +88,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json

- name: Install Task
uses: arduino/setup-task@v1
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/check-prettier-formatting-task.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
name: Check Prettier Formatting

env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 18.x

# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
create:
Expand Down Expand Up @@ -245,7 +241,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json

- name: Install Task
uses: arduino/setup-task@v1
Expand Down

0 comments on commit da8ef8b

Please sign in to comment.