dcodeIO / setup-node-nvm

Set up your GitHub Actions workflow with a specific version of node.js using nvm.
21 stars 13 forks source link

Install version from .nvmrc #1

Open dtothefp opened 5 years ago

dtothefp commented 5 years ago

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?

dcodeIO commented 5 years ago

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.

atifsyedali commented 5 years ago

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)

mrmanc commented 4 years ago

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.

dcodeIO commented 4 years ago

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?

mrmanc commented 4 years ago

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?

dtothefp commented 4 years ago

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

garfieldnate commented 1 year ago

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