-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve node version resolution #267
base: main
Are you sure you want to change the base?
Conversation
- Change matrix.node-version to matrix.node to match action input parameter - Update all references in test workflow to use consistent naming - Maintain alignment with user-facing parameter name
- Add node input parameter to main action.yaml - Add node input parameter to action-test/action.yaml - Support both major version (20) and specific version (20.18.1) formats
Changes need to be built and committed to In your local repo, run:
This will add those changes to your last commit, and get them pushed to the remote. Changes need to be built and committed to In your local repo, run:
This will add those changes to your last commit, and get them pushed to the remote. Changes need to be built and committed to In your local repo, run:
This will add those changes to your last commit, and get them pushed to the remote. |
c020e3a
to
7767eae
Compare
- Add handling for major version numbers (e.g., 20) in parseNvmrcVersion - Return latest stable version for major version inputs (e.g., 20 -> 20.18.1) - Add tests for major version resolution and specific version handling - Move version resolution logic into parseNvmrcVersion method This allows workflows to use simpler version specifications like: node: 20 instead of requiring exact versions like: node: 20.18.1
Node.js Version Resolution Enhancement
Problem
The action currently fails when using major version numbers (e.g.,
node: "20"
) in workflows, producing an error that lists all versions containing "20" without properly resolving to the latest stable version.Solution
Enhanced the Node version resolution logic to:
Changes
getNodeVersion()
innode.js
to handle major version numbersTesting
npm test
)Example Usage
Major Version (Recommended)
Specific Version
Using Version Files
The action also supports reading versions from standard Node.js version files:
Using .node-version
Using .nvmrc
The action will automatically:
.node-version
if present.nvmrc
if present