Skip to content

Commit

Permalink
chore(NODE-5543): fix duplicate PR highlights (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Aug 17, 2023
1 parent bcc9211 commit db2fc68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/scripts/highlights.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ async function pullRequestHighlights(prs) {
if (!highlights.length) return '';

highlights.unshift('## Release Notes\n\n');
return highlights.join('\n\n');

const highlight = highlights.join('\n\n');
console.log(`Total highlight is ${highlight.length} characters long`);
return highlight;
}

console.log('List of PRs to collect highlights from:', prs);
Expand Down
12 changes: 8 additions & 4 deletions .github/scripts/pr_list.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ const historyFilePath = path.join(__dirname, '..', '..', 'HISTORY.md');
*/
function parsePRList(history) {
const prRegexp = /js-bson\/issues\/(?<prNum>\d+)\)/iu;
return history
.split('\n')
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
.filter(prNum => prNum !== '');
return Array.from(
new Set(
history
.split('\n')
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
.filter(prNum => prNum !== '')
)
);
}

const historyContents = await fs.readFile(historyFilePath, { encoding: 'utf8' });
Expand Down

0 comments on commit db2fc68

Please sign in to comment.