|
@@ -31,6 +31,24 @@ type Environment struct {
|
|
|
GithubWebhookID int64
|
|
GithubWebhookID int64
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func getGitRepoBranches(branches string) []string {
|
|
|
|
|
+ var branchesArr []string
|
|
|
|
|
+
|
|
|
|
|
+ if branches != "" {
|
|
|
|
|
+ supposedBranches := strings.Split(branches, ",")
|
|
|
|
|
+
|
|
|
|
|
+ for _, br := range supposedBranches {
|
|
|
|
|
+ name := strings.TrimSpace(br)
|
|
|
|
|
+
|
|
|
|
|
+ if len(name) > 0 {
|
|
|
|
|
+ branchesArr = append(branchesArr, name)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return branchesArr
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (e *Environment) ToEnvironmentType() *types.Environment {
|
|
func (e *Environment) ToEnvironmentType() *types.Environment {
|
|
|
return &types.Environment{
|
|
return &types.Environment{
|
|
|
ID: e.Model.ID,
|
|
ID: e.Model.ID,
|
|
@@ -39,7 +57,7 @@ func (e *Environment) ToEnvironmentType() *types.Environment {
|
|
|
GitInstallationID: e.GitInstallationID,
|
|
GitInstallationID: e.GitInstallationID,
|
|
|
GitRepoOwner: e.GitRepoOwner,
|
|
GitRepoOwner: e.GitRepoOwner,
|
|
|
GitRepoName: e.GitRepoName,
|
|
GitRepoName: e.GitRepoName,
|
|
|
- GitRepoBranches: strings.Split(e.GitRepoBranches, ","),
|
|
|
|
|
|
|
+ GitRepoBranches: getGitRepoBranches(e.GitRepoBranches),
|
|
|
|
|
|
|
|
NewCommentsDisabled: e.NewCommentsDisabled,
|
|
NewCommentsDisabled: e.NewCommentsDisabled,
|
|
|
|
|
|