|
|
@@ -5,6 +5,7 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"net/http"
|
|
|
+ "strings"
|
|
|
|
|
|
"github.com/google/go-github/v41/github"
|
|
|
"github.com/porter-dev/porter/api/server/authz"
|
|
|
@@ -110,6 +111,24 @@ func (c *DeleteDeploymentHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ originalBranches := strings.Split(env.GitDeployBranches, ",")
|
|
|
+ newBranches := []string{}
|
|
|
+
|
|
|
+ for _, branch := range originalBranches {
|
|
|
+ if branch != depl.PRBranchFrom {
|
|
|
+ newBranches = append(newBranches, branch)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ env.GitDeployBranches = strings.Join(newBranches, ",")
|
|
|
+
|
|
|
+ _, err = c.Repo().Environment().UpdateEnvironment(env)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if depl.GHDeploymentID != 0 {
|
|
|
// set the GitHub deployment status to be inactive
|
|
|
_, _, err := client.Repositories.CreateDeploymentStatus(
|