Skip to content

Commit

Permalink
👷 [RUMF-1185] remove som useless entries from changelog generation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan authored Feb 15, 2022
1 parent 5bd928e commit 48f5747
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/generate-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,28 @@ 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}))`
)

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)
Expand Down

0 comments on commit 48f5747

Please sign in to comment.