Skip to content
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

Add node-version-file support for use-node-version in .npmrc files #1253

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update documentation
  • Loading branch information
kyle-leonhard committed Mar 19, 2025
commit 9aee14b09c2ca4272ab1363b6c1098b63ca0bcf3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ See [action.yml](action.yml)
# Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node
node-version: ''

# File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.
# File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions, .npmrc.
# If node-version and node-version-file are both provided the action will use version from node-version.
node-version-file: ''

2 changes: 1 addition & 1 deletion __tests__/README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ Files located in data directory are used only for testing purposes.


## Here the list of files in the data directory
- `.nvmrc`, `.tools-versions` and `package.json` are used to test node-version-file logic
- `.nvmrc`, `.tools-versions`, `package.json` and `.npmrc` are used to test node-version-file logic
- `package-lock.json`, `pnpm-lock.yaml` and `yarn.lock` are used to test cache logic
- `versions-manifest.json` is used for unit testing to check downloading Node.js versions from the node-versions repository.
- `node-dist-index.json` is used for unit testing to check downloading Node.js versions from the official site. The file was constructed from https://nodejs.org/dist/index.json
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ inputs:
node-version:
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
node-version-file:
description: 'File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.'
description: 'File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions, .npmrc.'
architecture:
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
check-latest:
2 changes: 1 addition & 1 deletion docs/advanced-usage.md
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ steps:

## Node version file

The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc`, `.node-version`, `.tool-versions`, or `package.json`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc`, `.node-version`, `.tool-versions`, `package.json`, or `.npmrc`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax).

> The action will search for the node version file relative to the repository root.