-
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
Expand current syntax to support aliases for latest version (current/latest/node) #483
Merged
dmitry-shibanov
merged 23 commits into
actions:main
from
panticmilos:v-mpantic/add-latest-alias
May 12, 2022
+75
−0
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b08c363
add node aliases
panticmilos db7606a
add test workflow dispatch
panticmilos 7e4e7cc
fix test
panticmilos d421731
revert test changes
panticmilos 983e751
add last line
panticmilos fdd5410
add unit tests
panticmilos e95e27a
revert functions exports
panticmilos eeff01b
Merge branch 'main' into v-mpantic/add-latest-alias
panticmilos dd0c4c2
update readme
panticmilos 21115fb
Change e2e tests
panticmilos c94bad8
remove echo
panticmilos 3aee215
update the documentation
panticmilos abfc09f
update the build
panticmilos 9d28777
apply prettier
panticmilos 66b5fd1
merge main
panticmilos 9056cd3
update dist
panticmilos 762cd63
Merge branch 'actions:main' into v-mpantic/add-latest-alias
panticmilos dd2d493
update e2e
panticmilos 3a94d56
fix e2e
panticmilos 07e689a
remove quotes on comparing string
panticmilos bd4ffc7
amend unit tests
panticmilos 87c4bf1
build dist
panticmilos 6e4956e
revert bumping dependecies
panticmilos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add unit tests
- Loading branch information
commit fdd541042be1bb391a2c056ee54d601d796baf87
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,6 +7,7 @@ import * as tc from '@actions/tool-cache'; | |||||
import * as path from 'path'; | ||||||
import * as semver from 'semver'; | ||||||
import fs = require('fs'); | ||||||
import * as installer from './installer'; | ||||||
|
||||||
// | ||||||
// Node versions interface | ||||||
|
@@ -237,7 +238,7 @@ function resolveLtsAliasFromManifest( | |||||
return release.version.split('.')[0]; | ||||||
} | ||||||
|
||||||
async function getInfoFromManifest( | ||||||
export async function getInfoFromManifest( | ||||||
versionSpec: string, | ||||||
stable: boolean, | ||||||
auth: string | undefined, | ||||||
|
@@ -263,7 +264,7 @@ async function getInfoFromManifest( | |||||
return info; | ||||||
} | ||||||
|
||||||
async function getInfoFromDist( | ||||||
export async function getInfoFromDist( | ||||||
versionSpec: string, | ||||||
arch: string = os.arch() | ||||||
): Promise<INodeVersionInfo | null> { | ||||||
|
@@ -320,7 +321,7 @@ async function resolveVersionFromManifest( | |||||
} | ||||||
|
||||||
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there | ||||||
function evaluateVersions(versions: string[], versionSpec: string): string { | ||||||
export function evaluateVersions(versions: string[], versionSpec: string): string { | ||||||
let version = ''; | ||||||
core.debug(`evaluating ${versions.length} versions`); | ||||||
versions = versions.sort((a, b) => { | ||||||
|
@@ -347,7 +348,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string { | |||||
return version; | ||||||
} | ||||||
|
||||||
async function queryDistForMatch( | ||||||
export async function queryDistForMatch( | ||||||
versionSpec: string, | ||||||
arch: string = os.arch() | ||||||
): Promise<string> { | ||||||
|
@@ -371,10 +372,11 @@ async function queryDistForMatch( | |||||
} | ||||||
|
||||||
let versions: string[] = []; | ||||||
let nodeVersions = await getVersionsFromDist(); | ||||||
let nodeVersions = await installer.getVersionsFromDist(); | ||||||
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. If we omit the import statement above, we can omit that also:
Suggested change
|
||||||
|
||||||
if (versionSpec === 'current' || versionSpec === 'latest' || versionSpec === 'node') { | ||||||
return nodeVersions[0].version | ||||||
core.info(`getting latest node version...`); | ||||||
return nodeVersions[0].version; | ||||||
} | ||||||
|
||||||
nodeVersions.forEach((nodeVersion: INodeVersion) => { | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 suggest omitting this import statement.