|
|
@ -134,29 +134,26 @@ func ParseCommitsInfo(info []CommitInfo) string { |
|
|
|
"break": {}, |
|
|
|
"break": {}, |
|
|
|
"other": {}, |
|
|
|
"other": {}, |
|
|
|
} |
|
|
|
} |
|
|
|
for i, commitInfo := range info { |
|
|
|
|
|
|
|
|
|
|
|
for _, commitInfo := range info { |
|
|
|
msg := commitInfo.Commit.Message |
|
|
|
msg := commitInfo.Commit.Message |
|
|
|
index := strings.Index(fmt.Sprintf("%q", msg), `\n`) |
|
|
|
index := strings.Index(fmt.Sprintf("%q", msg), `\n`) |
|
|
|
if index != -1 { |
|
|
|
if index != -1 { |
|
|
|
msg = commitInfo.Commit.Message[:index-1] |
|
|
|
msg = msg[:index-1] |
|
|
|
} |
|
|
|
} |
|
|
|
prefix := []string{"fix", "feat", "deps", "break"} |
|
|
|
prefix := []string{"fix", "feat", "deps", "break"} |
|
|
|
|
|
|
|
var matched bool |
|
|
|
for _, v := range prefix { |
|
|
|
for _, v := range prefix { |
|
|
|
if strings.HasPrefix(msg, v) { |
|
|
|
if strings.HasPrefix(msg, v) { |
|
|
|
group[v] = append(group[v], msg) |
|
|
|
group[v] = append(group[v], msg) |
|
|
|
info = append(info[:i], info[i+1:]...) |
|
|
|
matched = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if !matched { |
|
|
|
// other
|
|
|
|
group["other"] = append(group["other"], msg) |
|
|
|
for _, value := range info { |
|
|
|
|
|
|
|
msg := value.Commit.Message |
|
|
|
|
|
|
|
index := strings.Index(fmt.Sprintf("%q", msg), `\n`) |
|
|
|
|
|
|
|
if index != -1 { |
|
|
|
|
|
|
|
msg = value.Commit.Message[:index-1] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
group["other"] = append(group["other"], msg) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
md := make(map[string]string) |
|
|
|
md := make(map[string]string) |
|
|
|
for key, value := range group { |
|
|
|
for key, value := range group { |
|
|
|
var text string |
|
|
|
var text string |
|
|
@ -223,4 +220,4 @@ func ParseGithubUrl(url string) (owner string, repo string) { |
|
|
|
func fatal(err error) { |
|
|
|
func fatal(err error) { |
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) |
|
|
|
fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err) |
|
|
|
os.Exit(1) |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
} |