Skip to content

Commit 8957c9b

Browse files
Trottdanielleadams
authored andcommitted
build,tools: automate enforcement of emeritus criteria
PR-URL: #41155 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Stewart X Addison <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Danielle Adams <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
1 parent e26c187 commit 8957c9b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

.github/workflows/find-inactive-collaborators.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
env:
1111
NODE_VERSION: lts/*
12-
NUM_COMMITS: 5000
1312

1413
jobs:
1514
find:
@@ -19,7 +18,7 @@ jobs:
1918
steps:
2019
- uses: actions/checkout@v2
2120
with:
22-
fetch-depth: ${{ env.NUM_COMMITS }}
21+
fetch-depth: 0
2322
persist-credentials: false
2423

2524
- name: Use Node.js ${{ env.NODE_VERSION }}
@@ -28,7 +27,7 @@ jobs:
2827
node-version: ${{ env.NODE_VERSION }}
2928

3029
- name: Find inactive collaborators
31-
run: tools/find-inactive-collaborators.mjs ${{ env.NUM_COMMITS }}
30+
run: tools/find-inactive-collaborators.mjs
3231

3332
- name: Open pull request
3433
uses: gr2m/create-or-update-pull-request-action@v1

tools/find-inactive-collaborators.mjs

+4-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import cp from 'node:child_process';
88
import fs from 'node:fs';
99
import readline from 'node:readline';
1010

11-
const SINCE = +process.argv[2] || 5000;
11+
const SINCE = process.argv[2] || '18 months ago';
1212

1313
async function runGitCommand(cmd, mapFn) {
1414
const childProcess = cp.spawn('/bin/sh', ['-c', cmd], {
@@ -42,19 +42,13 @@ async function runGitCommand(cmd, mapFn) {
4242

4343
// Get all commit authors during the time period.
4444
const authors = await runGitCommand(
45-
`git shortlog -n -s --email --max-count="${SINCE}" HEAD`,
46-
(line) => line.trim().split('\t', 2)[1]
47-
);
48-
49-
// Get all commit landers during the time period.
50-
const landers = await runGitCommand(
51-
`git shortlog -n -s -c --email --max-count="${SINCE}" HEAD`,
45+
`git shortlog -n -s --email --since="${SINCE}" HEAD`,
5246
(line) => line.trim().split('\t', 2)[1]
5347
);
5448

5549
// Get all approving reviewers of landed commits during the time period.
5650
const approvingReviewers = await runGitCommand(
57-
`git log --max-count="${SINCE}" | egrep "^ Reviewed-By: "`,
51+
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
5852
(line) => /^ Reviewed-By: ([^<]+)/.exec(line)[1].trim()
5953
);
6054

@@ -182,15 +176,13 @@ async function moveCollaboratorToEmeritus(peopleToMove) {
182176
// Get list of current collaborators from README.md.
183177
const collaborators = await getCollaboratorsFromReadme();
184178

185-
console.log(`In the last ${SINCE} commits:\n`);
179+
console.log(`Since ${SINCE}:\n`);
186180
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
187-
console.log(`* ${landers.size.toLocaleString()} landers have landed commits.`);
188181
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
189182
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);
190183

191184
const inactive = collaborators.filter((collaborator) =>
192185
!authors.has(collaborator.mailmap) &&
193-
!landers.has(collaborator.mailmap) &&
194186
!approvingReviewers.has(collaborator.name)
195187
);
196188

0 commit comments

Comments
 (0)