MCPcopy
hub / github.com/vercel/next.js / groupByLabels

Function groupByLabels

release.js:49–89  ·  view source on GitHub ↗
(commits, github)

Source from the content-addressed store, hash-verified

47}
48
49const groupByLabels = async (commits, github) => {
50 // Initialize the sections object with empty arrays
51 const sections = Object.keys(sectionLabelMap).reduce((sections, section) => {
52 sections[section] = []
53 return sections
54 }, {})
55 sections.__fallback = []
56
57 for (const commit of commits) {
58 const pullRequest = await getCommitPullRequest(commit, github)
59
60 if (pullRequest) {
61 const section = getSectionForPullRequest(pullRequest)
62
63 if (section) {
64 // Add the change to the respective section
65 sections[section].push({
66 title: pullRequest.title,
67 number: pullRequest.number,
68 })
69
70 continue
71 }
72
73 // No section found, add it to the fallback section
74 sections.__fallback.push({
75 title: pullRequest.title,
76 number: pullRequest.number,
77 })
78
79 continue
80 }
81
82 // No Pull Request found, add it to the fallback section but without the number
83 sections.__fallback.push({
84 title: commit.title,
85 })
86 }
87
88 return sections
89}
90
91function cleanupPRTitle(title) {
92 if (title.startsWith('[Docs] ')) {

Callers 1

release.jsFile · 0.85

Calls 5

getCommitPullRequestFunction · 0.85
getSectionForPullRequestFunction · 0.85
reduceMethod · 0.80
keysMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…