MCPcopy
hub / github.com/desktop/desktop / convertToChangelogFormat

Function convertToChangelogFormat

script/changelog/parser.ts:115–143  ·  view source on GitHub ↗
(
  lines: ReadonlyArray<string>
)

Source from the content-addressed store, hash-verified

113}
114
115export 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
145export function getChangelogEntriesSince(previousVersion: string): string[] {
146 const root = Path.dirname(Path.dirname(__dirname))

Callers 1

runFunction · 0.90

Calls 5

fetchPRFunction · 0.90
parseCommitTitleFunction · 0.85
getChangelogEntryFunction · 0.85
warnMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected