3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-22 11:25:31 +00:00

Use parseInt instead of Number to handle empty strings

This commit is contained in:
Dave Hadka 2020-10-02 10:55:30 -05:00
parent a6f1f4b32e
commit 4bceb75b5b
4 changed files with 13 additions and 8 deletions

View file

@ -68,8 +68,8 @@ export function getInputAsInt(
name: string,
options?: core.InputOptions
): number | undefined {
const value = Number(core.getInput(name, options));
if (Number.isNaN(value) || value < 0) {
const value = parseInt(core.getInput(name, options));
if (isNaN(value) || value < 0) {
return undefined;
}
return value;