Skip to content

Commit c925bc1

Browse files
aduh95marco-ippolito
authored andcommittedMay 3, 2024
tools: take co-authors into account in find-inactive-collaborators
PR-URL: #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>
1 parent a920489 commit c925bc1

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed
 

‎tools/find-inactive-collaborators.mjs

+6-14
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,10 @@ async function runGitCommand(cmd, mapFn) {
4747
return Promise.race([errorHandler, Promise.resolve(returnValue)]);
4848
}
4949

50-
// Get all commit authors during the time period.
51-
const authors = await runGitCommand(
52-
`git shortlog -n -s --email --since="${SINCE}" HEAD`,
53-
(line) => line.trim().split('\t', 2)[1],
54-
);
55-
56-
// Get all approving reviewers of landed commits during the time period.
57-
const approvingReviewers = await runGitCommand(
58-
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
59-
(line) => /^ {4}Reviewed-By: ([^<]+)/.exec(line)[1].trim(),
50+
// Get all commit contributors during the time period.
51+
const contributors = await runGitCommand(
52+
`git log --pretty='format:%aN <%aE>%n%(trailers:only,valueonly,key=Co-authored-by)%n%(trailers:only,valueonly,key=Reviewed-by)' --since="${SINCE}" HEAD`,
53+
String,
6054
);
6155

6256
async function getCollaboratorsFromReadme() {
@@ -185,13 +179,11 @@ const collaborators = await getCollaboratorsFromReadme();
185179

186180
if (verbose) {
187181
console.log(`Since ${SINCE}:\n`);
188-
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
189-
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
182+
console.log(`* ${contributors.size.toLocaleString()} contributors`);
190183
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);
191184
}
192185
const inactive = collaborators.filter((collaborator) =>
193-
!authors.has(collaborator.mailmap) &&
194-
!approvingReviewers.has(collaborator.name),
186+
!contributors.has(collaborator.mailmap),
195187
);
196188

197189
if (inactive.length) {

0 commit comments

Comments
 (0)