-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 90 create support to custom flow
- Add support to read config file - Add support to create PR based on flow - Create branch based on flow
- Loading branch information
Isaac Martinez
committed
Jul 23, 2023
1 parent
2464fa7
commit 1794664
Showing
21 changed files
with
204 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,15 @@ | ||
package git_controller | ||
|
||
import "fmt" | ||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
func getBaseCmd(branch string) string { | ||
return fmt.Sprintf("git branch %s; git checkout %s", branch, branch) | ||
} | ||
|
||
func Feature(ticket string) (string, string) { | ||
branchName := "feature/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Bugfix(ticket string) (string, string) { | ||
branchName := "bugfix/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Hotfix(ticket string) (string, string) { | ||
branchName := "hotfix/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Release(ticket string) (string, string) { | ||
branchName := "release/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Support(ticket string) (string, string) { | ||
branchName := "support/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Test(ticket string) (string, string) { | ||
branchName := "test/" + ticket | ||
return getBaseCmd(branchName), branchName | ||
} | ||
|
||
func Sync(ticket string) (string, string) { | ||
branchName := "sync/" + ticket | ||
func Custom(path string, ticket string) (string, string) { | ||
branchName := strings.Replace(path, "*", ticket, 1) | ||
return getBaseCmd(branchName), branchName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package project | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/Minnek-Digital-Studio/cominnek/controllers/files" | ||
) | ||
|
||
var Config Cominnek | ||
|
||
func ReadConfigFile() bool { | ||
fileNames := []string{ | ||
"mnk-config.json", | ||
} | ||
|
||
for _, fileName := range fileNames { | ||
if files.CheckExist(fileName) { | ||
configByte := files.Read(fileName) | ||
Config = convertToJSON(configByte).Cominnek | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
func convertToJSON(data []byte) Project { | ||
var project Project | ||
err := json.Unmarshal([]byte(data), &project) | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return project | ||
} | ||
|
||
func GetConfigByName(name string) Branch { | ||
for _, branch := range Config.Git.Branches { | ||
if branch.Name == name { | ||
return branch | ||
} | ||
} | ||
|
||
return Branch{} | ||
} |
Oops, something went wrong.