Skip to content

Commit

Permalink
feat(plugin-git): remove duplicate no-reply contributors (#1364)
Browse files Browse the repository at this point in the history
Co-authored-by: Xinyu Liu <meteor.lxy@foxmail.com>
  • Loading branch information
lukemassa and meteorlxy authored Jul 11, 2023
1 parent 7d80137 commit 3ff1b06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ecosystem/plugin-git/src/node/utils/getContributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,19 @@ export const getContributors = async (
email,
commits: Number.parseInt(commits, 10),
}))
.filter((item, index, self) => {
// If one of the contributors is a "noreply" email address, and there's
// already a contributor with the same name, it is very likely a duplicate,
// so it can be removed.
if (item.email.split('@')[1]?.match(/no-?reply/)) {
const realIndex = self.findIndex((t) => t.name === item.name)
if (realIndex !== index) {
// Update the "real" contributor to also include the noreply's commits
self[realIndex].commits += item.commits
return false
}
return true
}
return true
})
}

0 comments on commit 3ff1b06

Please sign in to comment.