From 14570b1411f7f15083ccc19f6c36f29e862b24ba Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Fri, 1 Jul 2022 13:49:07 +0000 Subject: [PATCH] Avoid an error when dealing with failed deployments Fixes #21. --- create-deployment.js | 1 - dist/index.js | 8 +++++--- index.js | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/create-deployment.js b/create-deployment.js index 2e8f67e..99898f1 100644 --- a/create-deployment.js +++ b/create-deployment.js @@ -161,6 +161,5 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b console.log('🥳 Deployment successful'); } catch (e) { core.setFailed(`😱 The deployment ${deploymentId} seems to have failed.`); - throw e; } } diff --git a/dist/index.js b/dist/index.js index f1d08a2..2ae29bf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -177,7 +177,6 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b console.log('🥳 Deployment successful'); } catch (e) { core.setFailed(`😱 The deployment ${deploymentId} seems to have failed.`); - throw e; } } @@ -211,8 +210,11 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b const runNumber = process.env['github_run_number'] || process.env['GITHUB_RUN_NUMBER']; try { - action.createDeployment(applicationName, fullRepositoryName, branchName, configLookupName, commitId, runNumber, skipSequenceCheck, core); - } catch (e) {} + await action.createDeployment(applicationName, fullRepositoryName, branchName, configLookupName, commitId, runNumber, skipSequenceCheck, core); + } catch (e) { + console.log(`👉🏻 ${e.message}`); + process.exit(1); + } })(); diff --git a/index.js b/index.js index 76e3552..02c48d6 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,9 @@ const runNumber = process.env['github_run_number'] || process.env['GITHUB_RUN_NUMBER']; try { - action.createDeployment(applicationName, fullRepositoryName, branchName, configLookupName, commitId, runNumber, skipSequenceCheck, core); - } catch (e) {} + await action.createDeployment(applicationName, fullRepositoryName, branchName, configLookupName, commitId, runNumber, skipSequenceCheck, core); + } catch (e) { + console.log(`👉🏻 ${e.message}`); + process.exit(1); + } })();