(commits, github)
| 47 | } |
| 48 | |
| 49 | const 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 | |
| 91 | function cleanupPRTitle(title) { |
| 92 | if (title.startsWith('[Docs] ')) { |
no test coverage detected
searching dependent graphs…