From c957162f91dc57606298ca697b50a7f45569dfaf Mon Sep 17 00:00:00 2001 From: maira-samtek Date: Tue, 5 Mar 2024 16:32:31 -0500 Subject: [PATCH] added error msg for workflow not having close status --- src/libs/jira-lib.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libs/jira-lib.ts b/src/libs/jira-lib.ts index fd27473..de1cb67 100644 --- a/src/libs/jira-lib.ts +++ b/src/libs/jira-lib.ts @@ -261,6 +261,18 @@ export class Jira { !processedTransitions.includes(transition.name.toLowerCase()) ); if (targetTransitions.length <= 0) { + const lastStatus = + processedTransitions[ + processedTransitions.length - 1 + ].toLowerCase(); + const doneStatuses = ["done", "closed", "close", "complete"]; + if (!doneStatuses.includes(lastStatus)) { + throw new Error( + "Unsupported Workflow: does not contain any of " + + doneStatuses.join(",") + + "statuses" + ); + } break; } const transitionId = targetTransitions[0].id;