From 1d455bc0fdbaa6980590b0176f5c1645018bdf82 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 26 Apr 2024 21:54:54 +0200 Subject: [PATCH] tools: take co-authors into account in `find-inactive-collaborators` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52669 Reviewed-By: Rich Trott Reviewed-By: Ulises Gascón Reviewed-By: Yagiz Nizipli Reviewed-By: Richard Lau Reviewed-By: Trivikram Kamat Reviewed-By: Marco Ippolito Reviewed-By: Chengzhong Wu Reviewed-By: Michael Dawson Reviewed-By: Moshe Atlow --- tools/find-inactive-collaborators.mjs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tools/find-inactive-collaborators.mjs b/tools/find-inactive-collaborators.mjs index 7a647475602..1dfa9c960c7 100755 --- a/tools/find-inactive-collaborators.mjs +++ b/tools/find-inactive-collaborators.mjs @@ -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) {