Return user, repo, branch
(bareName string)
| 59 | |
| 60 | // Return user, repo, branch |
| 61 | func ParseGithubRepo(bareName string) (string, string, string) { |
| 62 | |
| 63 | userRepo := strings.Split(bareName, "/") |
| 64 | |
| 65 | if len(userRepo) <= 1 { |
| 66 | fmt.Println("Invalid Bare path") |
| 67 | os.Exit(-1) |
| 68 | } |
| 69 | |
| 70 | user := userRepo[0] |
| 71 | repo := userRepo[1] |
| 72 | |
| 73 | repoBranch := strings.Split(repo, "#") |
| 74 | branch := "main" |
| 75 | if len(repoBranch) > 1 { |
| 76 | branch = repoBranch[1] |
| 77 | } |
| 78 | |
| 79 | repo = repoBranch[0] |
| 80 | |
| 81 | return user, repo, branch |
| 82 | } |