-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Log node and npm versions #137
Conversation
src/setup-node.ts
Outdated
@@ -17,6 +19,15 @@ async function run() { | |||
await installer.getNode(version); | |||
} | |||
|
|||
// Output version of node and npm that are being used | |||
const nodePath = await io.which('node'); | |||
const nodeVersion = cp.execSync(`${nodePath} --version`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't execSync return a buffer of bytes that you need toString() (safely)? See https://github.com/actions/setup-go/blob/master/src/main.ts#L56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought template strings (ex ${nodePath} --version
) already called .toString()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh - yeah. I think you're right. Just e2e test
src/setup-node.ts
Outdated
@@ -17,6 +19,15 @@ async function run() { | |||
await installer.getNode(version); | |||
} | |||
|
|||
// Output version of node and npm that are being used | |||
const nodePath = await io.which('node'); | |||
const nodeVersion = cp.execSync(`${nodePath} --version`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh - yeah. I think you're right. Just e2e test
src/setup-node.ts
Outdated
|
||
const npmPath = await io.which('npm'); | ||
const npmVersion = cp.execSync(`${npmPath} --version`); | ||
console.log(`npm Version: ${npmVersion}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why none of this would fail. On one hand I was thinking we should make all this best effort. But then I rethought that if this can't work, then the action didn't do it's job so it should fail. So I think it's fine how it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 🎆
@joshmgross ☝️ |
dc85696
to
ffde538
Compare
Thanks @fishcharlie, it was an issue with the spaces in the Windows Path, causing the path to not be interpreted correctly by I've switched to |
@joshmgross Perfect. Looks great! Thanks for this. Never seen Looking forward to seeing this be merged and released as part of this action. Thanks again!! |
Bug on my part, but should be fixed now.
I think we would have to mock out |
@@ -1,4 +1,6 @@ | |||
import * as core from '@actions/core'; | |||
import * as exec from '@actions/exec'; | |||
import * as io from '@actions/io'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this unused @joshmgross?
Resolves #90
This logs the
node
andnpm
versions that are installed bysetup-node
, following the pattern established bysetup-go
, see https://github.com/actions/setup-go/blob/v2-beta/src/main.ts#L54Example
Run: https://github.com/actions/setup-node/pull/137/checks?check_run_id=606120085#step:4:5
Log output