Skip to content

Commit

Permalink
feat: allow eslint workflow to use specific node version
Browse files Browse the repository at this point in the history
Useful when upgrading node versions in an app that has strict engine requirements
  • Loading branch information
CallumNZ committed Jan 16, 2025
1 parent 0b8e3aa commit 220946d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/reusable-eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ on:
A list of root directory/s to where a package.json and eslint
configuration file (eslint.config.mjs) exist.
e.g.: my/root/one my/cool/root/two
node-version:
required: false
type: string
default: "21.x"
description: |
The version of Node to use when installing node modules and
running eslint.
See https://github.com/actions/setup-node?tab=readme-ov-file#supported-version-syntax
for syntax.
jobs:
eslint:
runs-on: ubuntu-latest
Expand All @@ -20,7 +29,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "21.x"
node-version: ${{ inputs.node-version }}
- name: Install Node modules
id: install-node-modules
env:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ jobs:

### ESLint

STATUS: alpha
STATUS: beta

Used to run ESLint on one or more directories. The paths specified
should have a package.json with eslint defined, alongside an eslint config
Expand All @@ -1111,6 +1111,7 @@ jobs:
paths: |
./root/folder/one
./cool/root/folder/two
node-version: 22.x
```


Expand Down

0 comments on commit 220946d

Please sign in to comment.