Skip to content

Commit

Permalink
Install standard version of Node.js in "Check Website" workflow
Browse files Browse the repository at this point in the history
The "Check Website" workflow invokes the following chain of tasks:

1. `website:check`
2. `docs:generate`
3. `general:format-prettier`

This makes the Prettier tool a dependency of the workflow, which in turn introduces a dependency on npm, and thus on
Node.js.

Previously, the workflow didn't contain a step to run the "actions/setup-node" action, so it used whichever version of
npm happened to be installed in the runner machine, which happens to be 18.x currently. Now that the use of the
project's standard Node.js version 20.x is enforced, this caused the workflow to fail spuriously:

```
task: [npm:install-deps] npm install
npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: undefined
npm error notsup Not compatible with your version of node/npm: undefined
npm error notsup Required: {"node":"20.x"}
npm error notsup Actual:   {"npm":"10.7.0","node":"v18.20.4"}
```

The problem is solved by adding an "actions/setup-node" action step to the workflow to install the correct version of
Node.js.
  • Loading branch information
per1234 committed Oct 16, 2024
1 parent bb0b097 commit 7a66fef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/check-mkdocs-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ on:
push:
paths:
- ".github/workflows/check-mkdocs-task.ya?ml"
- "**/.npmrc"
- "Taskfile.ya?ml"
- "mkdocs.ya?ml"
- "package.json"
- "package-lock.json"
- "poetry.lock"
- "pyproject.toml"
- "docs/**"
Expand All @@ -24,8 +27,11 @@ on:
pull_request:
paths:
- ".github/workflows/check-mkdocs-task.ya?ml"
- "**/.npmrc"
- "Taskfile.ya?ml"
- "mkdocs.ya?ml"
- "package.json"
- "package-lock.json"
- "poetry.lock"
- "pyproject.toml"
- "docs/**"
Expand Down Expand Up @@ -87,6 +93,11 @@ jobs:
- name: Install Poetry
run: pip install poetry

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: package.json

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

0 comments on commit 7a66fef

Please sign in to comment.