diff --git a/.changeset/backstage-changelog.js b/.changeset/backstage-changelog.js index 61734f9f67..45ed53afe4 100644 --- a/.changeset/backstage-changelog.js +++ b/.changeset/backstage-changelog.js @@ -33,17 +33,28 @@ async function getDependencyReleaseLine(changesets, dependenciesUpdated) { } async function getReleaseLine(changeset, type, options) { - const { ignoreUserThanks: users = [] } = options ?? {}; - const ignoredLinks = new Set( - users.map(user => `[@${user}](https://github.com/${user})`), - ); + const { ignoreUserThanks = [], ...rest } = options ?? {}; const releaseLine = await defaultChangelogFunctions.getReleaseLine( changeset, type, - options, + rest, ); - return releaseLine.replace(/Thanks\s(.*)!\s/g, (_, group) => { - const links = group.split(', ').filter(link => !ignoredLinks.has(link)); + + const ignoredUsers = new Set(ignoreUserThanks); + return releaseLine.replace(/Thanks\s(.*)!\s/g, (_, text) => { + // extracts user name and profile url from the markdown link + const regex = /\[@(\w+)\]\((https:\/\/github\.com\/[^\)]+)\)/g; + + let matches; + const links = []; + + while ((matches = regex.exec(text)) !== null) { + const [, user, url] = matches; + if (!ignoredUsers.has(user)) { + links.push(`[@${user}](${url})`); + } + } + return links.length ? `Thanks ${links.join(', ')}! ` : ''; }); } diff --git a/.changeset/config.json b/.changeset/config.json index fe78edc9cf..94e435bd93 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,14 @@ "./backstage-changelog.js", { "repo": "backstage/backstage", - "ignoreUserThanks": ["benjdlambert", "freben", "jhaals", "Rugvip"] + "ignoreUserThanks": [ + "benjdlambert", + "freben", + "jhaals", + "Rugvip", + "renovate", + "dependabot" + ] } ], "commit": false,