From f877c22e9cec77a87dc6548364c30cca5da40812 Mon Sep 17 00:00:00 2001 From: Jacob Wallraff Date: Tue, 10 Jan 2023 11:54:41 -0800 Subject: [PATCH] Remove support for */TUE --- actions-workflow-parser/src/model/converter/cron.test.ts | 3 ++- actions-workflow-parser/src/model/converter/cron.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 }