( lines: ReadonlyArray<string> )
| 113 | } |
| 114 | |
| 115 | export async function convertToChangelogFormat( |
| 116 | lines: ReadonlyArray<string> |
| 117 | ): Promise<ReadonlyArray<string>> { |
| 118 | const entries = [] |
| 119 | for (const line of lines) { |
| 120 | try { |
| 121 | const commit = parseCommitTitle(line) |
| 122 | const pr = fetchPR(commit.prID) |
| 123 | if (!pr) { |
| 124 | throw new Error(`Unable to get PR from API: ${commit.prID}`) |
| 125 | } |
| 126 | // Skip release PRs |
| 127 | if (pr.headRefName.startsWith('releases/')) { |
| 128 | continue |
| 129 | } |
| 130 | |
| 131 | const entry = getChangelogEntry(commit, pr) |
| 132 | if (entry !== null) { |
| 133 | entries.push(entry) |
| 134 | } |
| 135 | } catch (e) { |
| 136 | console.warn('Unable to parse line, using the full message.', e) |
| 137 | |
| 138 | entries.push(`[${PlaceholderChangeType}] ${line}`) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return entries |
| 143 | } |
| 144 | |
| 145 | export function getChangelogEntriesSince(previousVersion: string): string[] { |
| 146 | const root = Path.dirname(Path.dirname(__dirname)) |
no test coverage detected