From 34284a5bcc233afc69106cd582744ea5c7b399fd Mon Sep 17 00:00:00 2001 From: Maher Isnard Date: Thu, 14 Mar 2024 11:42:02 -0400 Subject: [PATCH] bugfix(api): Fix api reponse on build failure --- dist/action.js | 6 +++--- package-lock.json | 4 ++-- src/action.ts | 6 +++--- src/types.d.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/action.js b/dist/action.js index 9f0dc31..0219b8f 100644 --- a/dist/action.js +++ b/dist/action.js @@ -11302,20 +11302,20 @@ async function run() { markedAsInProgress = true; } } - if (latestStage.status === "failed") { + if (latestStage.status === "failure") { waiting = false; core.setFailed(`Deployment failed on step: ${latestStage.name}!`); await updateDeployment(token, deployment, "failure"); return; } - if (latestStage.name === "deploy" && ["success", "failed"].includes(latestStage.status)) { + if (latestStage.name === "deploy" && ["success", "failure"].includes(latestStage.status)) { waiting = false; const aliasUrl = deployment.aliases && deployment.aliases.length > 0 ? deployment.aliases[0] : deployment.url; core.setOutput("id", deployment.id); core.setOutput("environment", deployment.environment); core.setOutput("url", deployment.url); core.setOutput("alias", aliasUrl); - core.setOutput("success", deployment.latest_stage.status === "success" ? true : false); + core.setOutput("success", deployment.latest_stage.status === "success"); if (token !== "") { await updateDeployment(token, deployment, latestStage.status === "success" ? "success" : "failure"); } diff --git a/package-lock.json b/package-lock.json index 638b4bd..b4c5aee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cf-pages-await", - "version": "1.1.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cf-pages-await", - "version": "1.1.0", + "version": "1.3.0", "license": "MIT", "dependencies": { "@actions/core": "^1.6.0", diff --git a/src/action.ts b/src/action.ts index 3b8d10d..827aa7b 100644 --- a/src/action.ts +++ b/src/action.ts @@ -52,14 +52,14 @@ export default async function run() { } } - if (latestStage.status === 'failed') { + if (latestStage.status === 'failure') { waiting = false; core.setFailed(`Deployment failed on step: ${latestStage.name}!`); await updateDeployment(token, deployment, 'failure'); return; } - if (latestStage.name === 'deploy' && ['success', 'failed'].includes(latestStage.status)) { + if (latestStage.name === 'deploy' && ['success', 'failure'].includes(latestStage.status)) { waiting = false; const aliasUrl = deployment.aliases && deployment.aliases.length > 0 ? deployment.aliases[0] : deployment.url; @@ -69,7 +69,7 @@ export default async function run() { core.setOutput('environment', deployment.environment); core.setOutput('url', deployment.url); core.setOutput('alias', aliasUrl); - core.setOutput('success', deployment.latest_stage.status === 'success' ? true : false); + core.setOutput('success', deployment.latest_stage.status === 'success'); // Update deployment (if enabled) if (token !== '') { diff --git a/src/types.d.ts b/src/types.d.ts index f4de54b..bed5b0d 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -88,7 +88,7 @@ export interface Stage { name: 'queued'|'initialize'|'clone_repo'|'build'|'deploy'; started_on: string; ended_on: string; - status: 'idle'|'active'|'success'|'failed' + status: 'idle'|'active'|'success'|'failure' } export interface Trigger {