tools: take co-authors into account in `find-inactive-collaborators`

PR-URL: https://github.com/nodejs/node/pull/52669
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Antoine du Hamel 2024-04-26 21:54:54 +02:00 committed by GitHub
parent e4c1d020dc
commit 1d455bc0fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 14 deletions

View File

@ -47,16 +47,10 @@ async function runGitCommand(cmd, mapFn) {
return Promise.race([errorHandler, Promise.resolve(returnValue)]);
}
// Get all commit authors during the time period.
const authors = await runGitCommand(
`git shortlog -n -s --email --since="${SINCE}" HEAD`,
(line) => line.trim().split('\t', 2)[1],
);
// Get all approving reviewers of landed commits during the time period.
const approvingReviewers = await runGitCommand(
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
(line) => /^ {4}Reviewed-By: ([^<]+)/.exec(line)[1].trim(),
// Get all commit contributors during the time period.
const contributors = await runGitCommand(
`git log --pretty='format:%aN <%aE>%n%(trailers:only,valueonly,key=Co-authored-by)%n%(trailers:only,valueonly,key=Reviewed-by)' --since="${SINCE}" HEAD`,
String,
);
async function getCollaboratorsFromReadme() {
@ -185,13 +179,11 @@ const collaborators = await getCollaboratorsFromReadme();
if (verbose) {
console.log(`Since ${SINCE}:\n`);
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
console.log(`* ${contributors.size.toLocaleString()} contributors`);
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);
}
const inactive = collaborators.filter((collaborator) =>
!authors.has(collaborator.mailmap) &&
!approvingReviewers.has(collaborator.name),
!contributors.has(collaborator.mailmap),
);
if (inactive.length) {