diff --git a/scripts/generate-changelog.js b/scripts/generate-changelog.js index ec071d395d..9761b63c9a 100644 --- a/scripts/generate-changelog.js +++ b/scripts/generate-changelog.js @@ -75,7 +75,13 @@ async function getChangesList() { const changesWithEmojis = emojiNameToUnicode(commits) - const changesWithPullRequestLinks = changesWithEmojis.replace( + const allowedChanges = changesWithEmojis + .split('\n') + .filter(isNotVersionEntry) + .filter(isNotMaintenanceEntry) + .join('\n') + + const changesWithPullRequestLinks = allowedChanges.replace( /\(#(\d+)\)/gm, (_, id) => `([#${id}](https://github.com/DataDog/browser-sdk/pull/${id}))` ) @@ -83,6 +89,14 @@ async function getChangesList() { return changesWithPullRequestLinks } +function isNotVersionEntry(line) { + return !/^- v\d+\.\d+\.\d+/.test(line) +} + +function isNotMaintenanceEntry(line) { + return !/^- 👷/.test(line) +} + function emojiNameToUnicode(changes) { const emojiNameRegex = new RegExp(/:[^:\s]*(?:::[^:\s]*)*:/, 'gm') return changes.replace(emojiNameRegex, (emoji) => emojiNameMap.get(emoji) || emoji)