Skip to content

Commit 0201f3f

Browse files
Trotttargos
authored andcommitted
tools: ping TSC members identified as inactive
When detecting TSC members as inactive, @-mention them in the pull request that moves them to emeritus. This notifies them in case the pull request is in error. PR-URL: #40915 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]>
1 parent 3c8aa21 commit 0201f3f

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
node-version: ${{ env.NODE_VERSION }}
3333

3434
- name: Find inactive TSC members
35-
run: tools/find-inactive-tsc.mjs
35+
run: tools/find-inactive-tsc.mjs >> $GITHUB_ENV
3636

3737
- name: Open pull request
3838
uses: gr2m/create-or-update-pull-request-action@v1
@@ -41,7 +41,12 @@ jobs:
4141
with:
4242
author: Node.js GitHub Bot <[email protected]>
4343
branch: actions/inactive-tsc
44-
body: This PR was generated by tools/find-inactive-tsc.yml.
44+
body: |
45+
This PR was generated by tools/find-inactive-tsc.yml.
46+
47+
@nodejs/tsc ${{ env.INACTIVE_TSC_HANDLES }}
48+
49+
${{ env.DETAILS_FOR_COMMIT_BODY }}
4550
commit-message: "meta: move one or more TSC members to emeritus"
4651
labels: meta
4752
title: "meta: move one or more TSC members to emeritus"

tools/find-inactive-tsc.mjs

+18-9
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ async function getAttendance(tscMembers, meetings) {
9696
if (match) {
9797
return match[1];
9898
}
99+
// Using `console.warn` so that stdout output is not generated.
100+
// The stdout output is consumed in find-inactive-tsc.yml.
99101
console.warn(`Attendee entry does not contain GitHub handle: ${line}`);
100102
return '';
101103
})
@@ -111,10 +113,6 @@ async function getVotingRecords(tscMembers, votes) {
111113
votingRecords[member] = 0;
112114
}
113115
for (const vote of votes) {
114-
// Skip if not a .json file, such as README.md.
115-
if (!vote.endsWith('.json')) {
116-
continue;
117-
}
118116
// Get the vote data.
119117
const voteData = JSON.parse(
120118
await fs.promises.readFile(path.join('.tmp', vote), 'utf8')
@@ -238,7 +236,7 @@ const lightAttendance = tscMembers.filter(
238236
// Get all votes since SINCE.
239237
// Assumes that the TSC repo is cloned in the .tmp dir.
240238
const votes = await runGitCommand(
241-
`git whatchanged --since '${SINCE}' --name-only --pretty=format: votes`,
239+
`git whatchanged --since '${SINCE}' --name-only --pretty=format: votes/*.json`,
242240
{ cwd: '.tmp', mapFn: (line) => line }
243241
);
244242

@@ -251,10 +249,21 @@ const noVotes = tscMembers.filter(
251249
const inactive = lightAttendance.filter((member) => noVotes.includes(member));
252250

253251
if (inactive.length) {
254-
console.log('\nInactive TSC members:\n');
255-
console.log(inactive.map((entry) => `* ${entry}`).join('\n'));
256-
console.log('\nGenerating new README.md file...');
252+
// The stdout output is consumed in find-inactive-tsc.yml. If format of output
253+
// changes, find-inactive-tsc.yml may need to be updated.
254+
console.log(`INACTIVE_TSC_HANDLES="${inactive.map((entry) => '@' + entry).join(' ')}"`);
255+
const commitDetails = inactive.map((entry) => {
256+
let details = `Since ${SINCE}, `;
257+
details += `${entry} attended ${attendance[entry]} out of ${meetings.size} meetings`;
258+
details += ` and voted in ${votingRecords[entry]} of ${votes.size} votes.`;
259+
return details;
260+
});
261+
console.log(`DETAILS_FOR_COMMIT_BODY="${commitDetails.join(' ')}"`);
262+
263+
// Using console.warn() to avoid messing with find-inactive-tsc which consumes
264+
// stdout.
265+
console.warn('Generating new README.md file...');
257266
const newReadmeText = await moveTscToEmeritus(inactive);
258267
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
259-
console.log('Updated README.md generated. Please commit these changes.');
268+
console.warn('Updated README.md generated. Please commit these changes.');
260269
}

0 commit comments

Comments
 (0)