build,tools: automate enforcement of emeritus criteria
PR-URL: https://github.com/nodejs/node/pull/41155 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Stewart X Addison <sxa@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Danielle Adams <adamzdanielle@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
parent
6749e3fb1c
commit
41e1de6f40
@ -9,7 +9,6 @@ on:
|
||||
|
||||
env:
|
||||
NODE_VERSION: lts/*
|
||||
NUM_COMMITS: 5000
|
||||
|
||||
jobs:
|
||||
find:
|
||||
@ -19,7 +18,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: ${{ env.NUM_COMMITS }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
@ -28,7 +27,7 @@ jobs:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Find inactive collaborators
|
||||
run: tools/find-inactive-collaborators.mjs ${{ env.NUM_COMMITS }}
|
||||
run: tools/find-inactive-collaborators.mjs
|
||||
|
||||
- name: Open pull request
|
||||
uses: gr2m/create-or-update-pull-request-action@v1
|
||||
|
@ -8,7 +8,7 @@ import cp from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import readline from 'node:readline';
|
||||
|
||||
const SINCE = +process.argv[2] || 5000;
|
||||
const SINCE = process.argv[2] || '18 months ago';
|
||||
|
||||
async function runGitCommand(cmd, mapFn) {
|
||||
const childProcess = cp.spawn('/bin/sh', ['-c', cmd], {
|
||||
@ -42,19 +42,13 @@ async function runGitCommand(cmd, mapFn) {
|
||||
|
||||
// Get all commit authors during the time period.
|
||||
const authors = await runGitCommand(
|
||||
`git shortlog -n -s --email --max-count="${SINCE}" HEAD`,
|
||||
(line) => line.trim().split('\t', 2)[1]
|
||||
);
|
||||
|
||||
// Get all commit landers during the time period.
|
||||
const landers = await runGitCommand(
|
||||
`git shortlog -n -s -c --email --max-count="${SINCE}" HEAD`,
|
||||
`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 --max-count="${SINCE}" | egrep "^ Reviewed-By: "`,
|
||||
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
|
||||
(line) => /^ Reviewed-By: ([^<]+)/.exec(line)[1].trim()
|
||||
);
|
||||
|
||||
@ -182,15 +176,13 @@ async function moveCollaboratorToEmeritus(peopleToMove) {
|
||||
// Get list of current collaborators from README.md.
|
||||
const collaborators = await getCollaboratorsFromReadme();
|
||||
|
||||
console.log(`In the last ${SINCE} commits:\n`);
|
||||
console.log(`Since ${SINCE}:\n`);
|
||||
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
|
||||
console.log(`* ${landers.size.toLocaleString()} landers have landed commits.`);
|
||||
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
|
||||
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);
|
||||
|
||||
const inactive = collaborators.filter((collaborator) =>
|
||||
!authors.has(collaborator.mailmap) &&
|
||||
!landers.has(collaborator.mailmap) &&
|
||||
!approvingReviewers.has(collaborator.name)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user