Skip to content

Commit 3ff1b06

Browse files
lukemassameteorlxy
andauthored
feat(plugin-git): remove duplicate no-reply contributors (#1364)
Co-authored-by: Xinyu Liu <[email protected]>
1 parent 7d80137 commit 3ff1b06

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ecosystem/plugin-git/src/node/utils/getContributors.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,19 @@ export const getContributors = async (
2323
email,
2424
commits: Number.parseInt(commits, 10),
2525
}))
26+
.filter((item, index, self) => {
27+
// If one of the contributors is a "noreply" email address, and there's
28+
// already a contributor with the same name, it is very likely a duplicate,
29+
// so it can be removed.
30+
if (item.email.split('@')[1]?.match(/no-?reply/)) {
31+
const realIndex = self.findIndex((t) => t.name === item.name)
32+
if (realIndex !== index) {
33+
// Update the "real" contributor to also include the noreply's commits
34+
self[realIndex].commits += item.commits
35+
return false
36+
}
37+
return true
38+
}
39+
return true
40+
})
2641
}

0 commit comments

Comments
 (0)