-
Notifications
You must be signed in to change notification settings - Fork 1.4k
consume getJson function for better error messages #110
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,11 @@ | |
"description": "setup node action", | ||
"main": "lib/setup-node.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "tsc && ncc build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aligned with the pattern set by setup-ruby |
||
"format": "prettier --write **/*.ts", | ||
"format-check": "prettier --check **/*.ts", | ||
"pack": "ncc build", | ||
"test": "jest", | ||
"all": "npm run build && npm run format && npm run pack && npm test" | ||
"pre-checkin": "npm run format && npm run build && npm test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -26,7 +25,7 @@ | |
"dependencies": { | ||
"@actions/core": "^1.2.2", | ||
"@actions/github": "^1.1.0", | ||
"@actions/http-client": "^1.0.3", | ||
"@actions/http-client": "^1.0.6", | ||
"@actions/io": "^1.0.2", | ||
"@actions/tool-cache": "^1.3.1", | ||
"semver": "^6.1.1" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,13 +105,8 @@ async function queryLatestMatch(versionSpec: string): Promise<string> { | |
allowRetries: true, | ||
maxRetries: 3 | ||
}); | ||
let response = await httpClient.get(dataUrl); | ||
assert.ok( | ||
response.message.statusCode === 200, | ||
`Unexpected HTTP status code '${response.message.statusCode}'` | ||
); | ||
let body = await response.readBody(); | ||
let nodeVersions = JSON.parse(body) as INodeVersion[]; | ||
let response = await httpClient.getJson<INodeVersion[]>(dataUrl); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getJson now checks for errors, so i removed the error checking code here |
||
let nodeVersions = response.result || []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
nodeVersions.forEach((nodeVersion: INodeVersion) => { | ||
// ensure this version supports your os and platform | ||
if (nodeVersion.files.indexOf(dataFileName) >= 0) { | ||
|
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.
npm run build
now runs ncc