diff --git a/actions-workflow-parser/src/model/converter/cron.test.ts b/actions-workflow-parser/src/model/converter/cron.test.ts index 9454c83..6f525ec 100644 --- a/actions-workflow-parser/src/model/converter/cron.test.ts +++ b/actions-workflow-parser/src/model/converter/cron.test.ts @@ -18,7 +18,6 @@ describe("isValidCron", () => { "0 0 * * SUN", "0 0 * * SUN-TUE", "0 0 * * SUN-2", - "0 * * */FEB */TUE", "0 2-4/5 * * *", ] @@ -40,6 +39,7 @@ describe("isValidCron", () => { "0 5--5 * * *", "0 *//5 * * *", "0 ,, * * *", + "0 , , , ,", "0 ** * * *", "0 0 * * BUN", "0 0 * SUN JAN", @@ -49,6 +49,7 @@ describe("isValidCron", () => { "0 2/4-5 * * *", "0 2-4-6 * * *", "0 2/4/6 * * *", + "0 * * */FEB */TUE", ] for (const cron of invalid) { diff --git a/actions-workflow-parser/src/model/converter/cron.ts b/actions-workflow-parser/src/model/converter/cron.ts index 911494d..1e65280 100644 --- a/actions-workflow-parser/src/model/converter/cron.ts +++ b/actions-workflow-parser/src/model/converter/cron.ts @@ -76,8 +76,8 @@ function validateRange( } const [start, step, ...rest] = value.split("/") - const stepNumber = convertToNumber(range, step) - if (rest.length > 0 || stepNumber <= 0 || !start || !step) { + const stepNumber = +step + if (rest.length > 0 || isNaN(stepNumber) || stepNumber <= 0 || !start || !step) { return false }