From 8be32606c4ecdb1f6ee60a10400827b84f31c0d0 Mon Sep 17 00:00:00 2001 From: Ivan Kiral Date: Wed, 20 Nov 2024 14:19:08 +0100 Subject: [PATCH] fix updating workflows --- src/modules/sync/sync/workflows.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/modules/sync/sync/workflows.ts b/src/modules/sync/sync/workflows.ts index 4c8f02bc..80e209e2 100644 --- a/src/modules/sync/sync/workflows.ts +++ b/src/modules/sync/sync/workflows.ts @@ -21,14 +21,16 @@ export const syncWorkflows = async ( logInfo(logOptions, "standard", "Updating workflows"); await serially( - [...operations.updated.keys()].map(codename => () => - modifyWorkflow( + [...operations.updated.entries()].filter(([, arr]) => arr.length).map(([key]) => key).map(codename => () => { + const sourceWorkflow = operations.sourceWorkflows.find(w => w.codename === codename) + ?? throwError(`Workflow { codename: ${codename} } not found.`); + + return modifyWorkflow( client, codename, - operations.sourceWorkflows.find(w => w.codename === codename) - ?? throwError(`Workflow { codename: ${codename} } not found.`), - ) - ), + sourceWorkflow, + ); + }), ); } else { logInfo(logOptions, "standard", "No workflows to update");