mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-11-25 08:38:38 +07:00
Add alias latest
This commit is contained in:
19
src/utils.ts
19
src/utils.ts
@ -22,6 +22,25 @@ export async function getInput(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to parse PHP version.
|
||||
*
|
||||
* @param version
|
||||
*/
|
||||
export async function parseVersion(version: string): Promise<string> {
|
||||
switch (version) {
|
||||
case 'latest':
|
||||
return '7.4';
|
||||
default:
|
||||
switch (true) {
|
||||
case version.length > 1:
|
||||
return version.slice(0, 3);
|
||||
default:
|
||||
return version + '.0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Async foreach loop
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user