mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
chore: trim no matter what
This commit is contained in:
parent
d86a20eb78
commit
1c48dc5a9e
2 changed files with 3 additions and 7 deletions
|
@ -495,17 +495,16 @@ function translateArchToDistUrl(arch: string): string {
|
|||
}
|
||||
|
||||
export function parseNodeVersionFile(contents: string): string {
|
||||
let nodeVersion;
|
||||
let nodeVersion = contents.trim();
|
||||
|
||||
if (contents.includes('volta')) {
|
||||
nodeVersion = JSON.parse(contents).volta.node;
|
||||
} else {
|
||||
nodeVersion = contents.trim();
|
||||
}
|
||||
|
||||
if (/^v\d/.test(nodeVersion)) {
|
||||
nodeVersion = nodeVersion.substring(1);
|
||||
}
|
||||
|
||||
return nodeVersion;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue