Skip to content

Commit

Permalink
chore(NODE-5544): fix duplicate PR highlights (#3816)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Aug 17, 2023
1 parent bd031fc commit 45f8fb9
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 = /node-mongodb-native\/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 45f8fb9

Please sign in to comment.