diff --git a/src/components/NewEnvironment/index.js b/src/components/NewEnvironment/index.js
index e429e7ec..0d4b07d4 100644
--- a/src/components/NewEnvironment/index.js
+++ b/src/components/NewEnvironment/index.js
@@ -95,7 +95,10 @@ const NewEnvironment = ({
if (error) {
return
{error.message}
;
}
- if (data && !data.deployEnvironmentBranch.includes("Skipped")) {
+ const errors = ["Skipped", "Error"]
+ const regex = new RegExp(errors.join("|"), "i");
+ const err = regex.test(data && data.deployEnvironmentBranch);
+ if (data && !err) {
refresh().then(setClear).then(closeModal);
}
@@ -224,7 +227,7 @@ const NewEnvironment = ({
inputBranchName={inputBranchName}
inputProjectName={inputProjectName}
loading={loading}
- error={data && data.deployEnvironmentBranch.includes("Skipped")}
+ error={err}
data={data}
/>