Skip to content

Commit

Permalink
Fix Ingest upstream changes for downstreams with missing sections
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Nov 21, 2023
1 parent da0a55c commit ef9157b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/release/merge-release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const main = async ({ github, releaseId, dependencies }) => {
const release = await getRelease(github, dependency);
for (const line of release.body.split("\n")) {
if (line.startsWith(HEADING_PREFIX)) {
heading = line;
heading = line.trim();
sections.set(heading, []);
continue;
}
if (heading && line) {
sections.get(heading).push(line);
sections.get(heading).push(line.trim());
}
}
}
Expand All @@ -60,10 +60,14 @@ const main = async ({ github, releaseId, dependencies }) => {
const output = [];
for (const line of [...release.body.split("\n"), null]) {
if (line === null || line.startsWith(HEADING_PREFIX)) {
while (heading && headings[0] !== heading && sections.has(headings[0])) {
// If we have a heading, and it's not the first in the list of pending headings, output the section.
// If we're processing the last line (null) then output all remaining sections.
while (headings.length > 0 && (line === null || (heading && headings[0] !== heading))) {
const heading = headings.shift();
output.push(heading);
output.push(...sections.get(heading));
if (sections.has(heading)) {
output.push(heading);
output.push(...sections.get(heading));
}
}

if (heading && sections.has(heading)) {
Expand Down

0 comments on commit ef9157b

Please sign in to comment.