Skip to content

Commit

Permalink
bugfix(api): Fix api reponse on build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Maher Isnard committed Mar 14, 2024
1 parent 8a912e1 commit 34284a5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dist/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 !== '') {
Expand Down
2 changes: 1 addition & 1 deletion src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 34284a5

Please sign in to comment.