MCPcopy Create free account
hub / github.com/google/go-github / splitIntoPRs

Function splitIntoPRs

tools/gen-release-notes/main.go:65–94  ·  view source on GitHub ↗
(text string)

Source from the content-addressed store, hash-verified

63}
64
65func splitIntoPRs(text string) []string {
66 parts := strings.Split("\n"+text, "\ncommit ")
67 if len(parts) < 2 {
68 log.Fatal("unable to find PRs")
69 }
70 prs := make([]string, 0, len(parts)-1)
71 for _, part := range parts {
72 if part == "" {
73 continue
74 }
75 lines := strings.Split(part, "\n")
76 if len(lines) < 5 { // commit, Author:, Date:, blank, msg
77 continue
78 }
79 var newPR []string
80 for _, line := range lines[1:] {
81 line = strings.TrimSpace(line)
82 if line == "" || strings.HasPrefix(line, "Author: ") || strings.HasPrefix(line, "Date: ") {
83 continue
84 }
85 if len(newPR) == 0 {
86 newPR = append(newPR, "* "+line)
87 } else {
88 newPR = append(newPR, " "+line)
89 }
90 }
91 prs = append(prs, strings.Join(newPR, "\n"))
92 }
93 return prs
94}
95
96func splitBreakingLines(allLines []string) (breaking, nonBreaking []string) {
97 for _, pr := range allLines {

Callers 1

genReleaseNotesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…