From 2c3ecb368be2751c3934cbe2168769b93b1cd975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Test=C3=A9?= Date: Fri, 5 Jul 2024 15:40:18 +0200 Subject: [PATCH] chore(slab): fix task status handling --- dist/index.js | 11 +++++++---- src/slab.js | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index c35eaf4..27988ed 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49774,15 +49774,18 @@ async function waitForInstance(taskId, taskName) { if (response.ok) { const body = await response.json() - if (body[taskName].status.toLowerCase() === 'done') { + const task_status = body[taskName].status.toLowerCase() + + if (task_status === 'done') { await removeTask(taskId) return body - } else if (body[taskName].status.toLowerCase() === 'failed') { - await removeTask(taskId) + } else if (task_status === 'failed') { core.error( - `Instance task failed (details: ${body[taskName].status.details})` + `Instance task failed (details: ${body[taskName].details})` ) core.setFailed('Failure occurred while waiting for instance.') + await removeTask(taskId) + return } } else { core.error( diff --git a/src/slab.js b/src/slab.js index 698e1a3..3c550ea 100644 --- a/src/slab.js +++ b/src/slab.js @@ -66,15 +66,18 @@ async function waitForInstance(taskId, taskName) { if (response.ok) { const body = await response.json() - if (body[taskName].status.toLowerCase() === 'done') { + const task_status = body[taskName].status.toLowerCase() + + if (task_status === 'done') { await removeTask(taskId) return body - } else if (body[taskName].status.toLowerCase() === 'failed') { - await removeTask(taskId) + } else if (task_status === 'failed') { core.error( - `Instance task failed (details: ${body[taskName].status.details})` + `Instance task failed (details: ${body[taskName].details})` ) core.setFailed('Failure occurred while waiting for instance.') + await removeTask(taskId) + return } } else { core.error(