setup-node-nvm icon indicating copy to clipboard operation
setup-node-nvm copied to clipboard

Install version from .nvmrc

Open dtothefp opened this issue 6 years ago • 7 comments

I'm new to GH actions and migrating from Travis. In Travis is .nvmrc is present that version will be used. Would it be possible to make this action respect the version in .nvmrc and omit the node-version argument?

dtothefp avatar Sep 24 '19 18:09 dtothefp

Should be possible. Maybe specifying node-version: "" already does the trick, or alternatively the default can be made an empty string with the install script skipping the explicit version setup.

dcodeIO avatar Sep 24 '19 19:09 dcodeIO

If you specify empty string, it installs the node version from the .nvmrc file in this repository...

Found '/home/runner/work/_actions/dcodeIO/setup-node-nvm/master/.nvmrc' with version <12.9.0>
Downloading https://nodejs.org/dist//v12.9.0/node-v12.9.0-linux-x64.tar.xz...
Downloading and installing node v12.9.0...

(I had 10.16.3 in my .nvmrc file)

atifsyedali avatar Nov 05 '19 18:11 atifsyedali

This would be really useful, but I’m not just posting a comment to ask for that feature. I wanted to suggest that in the meantime, it would be a good idea to change https://github.com/dcodeIO/setup-node-nvm/blob/23906d31b87a1bd9c40bf289219a57e40c4082d8/action.yml#L6. As far as I can see it doesn’t accurately describe what the action does, as it doesn’t pick up the .nvmrc file.

mrmanc avatar Jan 17 '20 10:01 mrmanc

Hmm, I thought https://github.com/dcodeIO/setup-node-nvm/commit/3fca218c735ab2d366213f72356e126e0a2fa57c would make it work. It essentially uses an empty node version by default, which should make nvm look up from .nvmrc. There's also a simple test verifying this, picking up the version in the repo's .nvmrc. Do you have any ideas why it's not working in your use case?

dcodeIO avatar Jan 17 '20 11:01 dcodeIO

Thanks for your reply 😃Ah, in that case ignore my comment! My particular case doesn’t work because I need to specify a working directory and there’s no mechanism to do that in GitHub Actions, but I assumed that point was moot as I found this issue still open. Would you say this issue should be resolved then?

mrmanc avatar Jan 17 '20 14:01 mrmanc

This is definitely not resolved IMO. You can see my PR where it is working

https://github.com/dcodeIO/setup-node-nvm/pull/2/files

dtothefp avatar Apr 15 '20 18:04 dtothefp

This doesn't work at all, and it would be great to at least change the description.

garfieldnate avatar Dec 24 '22 02:12 garfieldnate