Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: move one or more collaborators to emeritus #4

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/find-inactive-collaborators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ jobs:

- name: Find inactive collaborators
run: tools/find-inactive-collaborators.mjs ${{ env.NUM_COMMITS }}

- name: Open pull request
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "meta: move one or more collaborators to emeritus"
body: This PR was generated by tools/find-inactive-collaborators.yml.
commit-message: "meta: move one or more collaborators to emeritus"
labels: meta
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ For information on reporting security vulnerabilities in Node.js, see
For information about the governance of the Node.js project, see
[GOVERNANCE.md](./GOVERNANCE.md).

<!-- node-core-utils depends on the format of the TSC list. If the
format changes, those utilities need to be tested and updated. -->
### TSC (Technical Steering Committee)

<!--lint disable prohibited-strings-->
Expand Down Expand Up @@ -249,6 +251,9 @@ For information about the governance of the Node.js project, see

</details>

<!-- node-core-utils and find-inactive-collaborators.mjs depend on the format
of the collaborator list. If the format changes, those utilities need to be
tested and updated. -->
### Collaborators

* [addaleax](https://github.com/addaleax) -
Expand All @@ -273,8 +278,6 @@ For information about the governance of the Node.js project, see
**Beth Griggs** &lt;[email protected]&gt; (she/her)
* [bmeck](https://github.com/bmeck) -
**Bradley Farias** &lt;[email protected]&gt;
* [bmeurer](https://github.com/bmeurer) -
**Benedikt Meurer** &lt;[email protected]&gt;
* [boneskull](https://github.com/boneskull) -
**Christopher Hiller** &lt;[email protected]&gt; (he/him)
* [BridgeAR](https://github.com/BridgeAR) -
Expand Down Expand Up @@ -319,8 +322,6 @@ For information about the governance of the Node.js project, see
**Gerhard Stöbich** &lt;[email protected]&gt; (he/they)
* [gabrielschulhof](https://github.com/gabrielschulhof) -
**Gabriel Schulhof** &lt;[email protected]&gt;
* [geek](https://github.com/geek) -
**Wyatt Preul** &lt;[email protected]&gt;
* [gengjiawen](https://github.com/gengjiawen) -
**Jiawen Geng** &lt;[email protected]&gt;
* [GeoffreyBooth](https://github.com/geoffreybooth) -
Expand Down Expand Up @@ -377,8 +378,6 @@ For information about the governance of the Node.js project, see
**Milad Fa** &lt;[email protected]&gt; (he/him)
* [mildsunrise](https://github.com/mildsunrise) -
**Alba Mendez** &lt;[email protected]&gt; (she/her)
* [misterdjules](https://github.com/misterdjules) -
**Julien Gilli** &lt;[email protected]&gt;
* [mmarchini](https://github.com/mmarchini) -
**Mary Marchini** &lt;[email protected]&gt; (she/her)
* [mscdex](https://github.com/mscdex) -
Expand All @@ -397,8 +396,6 @@ For information about the governance of the Node.js project, see
**Stephen Belanger** &lt;[email protected]&gt; (he/him)
* [RaisinTen](https://github.com/RaisinTen) -
**Darshan Sen** &lt;[email protected]&gt; (he/him)
* [refack](https://github.com/refack) -
**Refael Ackermann (רפאל פלחי)** &lt;[email protected]&gt; (he/him/הוא/אתה)
* [rexagod](https://github.com/rexagod) -
**Pranshu Srivastava** &lt;[email protected]&gt; (he/him)
* [richardlau](https://github.com/richardlau) -
Expand Down Expand Up @@ -451,8 +448,6 @@ For information about the governance of the Node.js project, see
**Yash Ladha** &lt;[email protected]&gt; (he/him)
* [yhwang](https://github.com/yhwang) -
**Yihong Wang** &lt;[email protected]&gt;
* [yorkie](https://github.com/yorkie) -
**Yorkie Liu** &lt;[email protected]&gt;
* [yosuke-furukawa](https://github.com/yosuke-furukawa) -
**Yosuke Furukawa** &lt;[email protected]&gt;
* [ZYSzys](https://github.com/ZYSzys) -
Expand All @@ -462,6 +457,8 @@ For information about the governance of the Node.js project, see

<summary>Emeriti</summary>

<!-- find-inactive-collaborators.mjs depends on the format of the emeriti list.
If the format changes, those utilities need to be tested and updated. -->
### Collaborator emeriti

* [andrasq](https://github.com/andrasq) -
Expand All @@ -472,6 +469,8 @@ For information about the governance of the Node.js project, see
**Andreas Madsen** &lt;[email protected]&gt; (he/him)
* [aqrln](https://github.com/aqrln) -
**Alexey Orlenko** &lt;[email protected]&gt; (he/him)
* [bmeurer](https://github.com/bmeurer) -
**Benedikt Meurer** &lt;[email protected]&gt;
* [bnoordhuis](https://github.com/bnoordhuis) -
**Ben Noordhuis** &lt;[email protected]&gt;
* [brendanashworth](https://github.com/brendanashworth) -
Expand All @@ -494,6 +493,8 @@ For information about the governance of the Node.js project, see
**Daniel Wang** &lt;[email protected]&gt;
* [gdams](https://github.com/gdams) -
**George Adams** &lt;[email protected]&gt; (he/him)
* [geek](https://github.com/geek) -
**Wyatt Preul** &lt;[email protected]&gt;
* [gibfahn](https://github.com/gibfahn) -
**Gibson Fahnestock** &lt;[email protected]&gt; (he/him)
* [glentiki](https://github.com/glentiki) -
Expand Down Expand Up @@ -538,6 +539,8 @@ For information about the governance of the Node.js project, see
**Nicu Micleușanu** &lt;[email protected]&gt; (he/him)
* [mikeal](https://github.com/mikeal) -
**Mikeal Rogers** &lt;[email protected]&gt;
* [misterdjules](https://github.com/misterdjules) -
**Julien Gilli** &lt;[email protected]&gt;
* [monsanto](https://github.com/monsanto) -
**Christopher Monsanto** &lt;[email protected]&gt;
* [MoonBall](https://github.com/MoonBall) -
Expand All @@ -564,6 +567,8 @@ For information about the governance of the Node.js project, see
**Prince John Wesley** &lt;[email protected]&gt;
* [psmarshall](https://github.com/psmarshall) -
**Peter Marshall** &lt;[email protected]&gt; (he/him)
* [refack](https://github.com/refack) -
**Refael Ackermann (רפאל פלחי)** &lt;[email protected]&gt; (he/him/הוא/אתה)
* [rlidwka](https://github.com/rlidwka) -
**Alex Kocharin** &lt;[email protected]&gt;
* [rmg](https://github.com/rmg) -
Expand Down Expand Up @@ -602,6 +607,8 @@ For information about the governance of the Node.js project, see
**Vse Mozhet Byt** &lt;[email protected]&gt; (he/him)
* [whitlockjc](https://github.com/whitlockjc) -
**Jeremy Whitlock** &lt;[email protected]&gt;
* [yorkie](https://github.com/yorkie) -
**Yorkie Liu** &lt;[email protected]&gt;

</details>
<!--lint enable prohibited-strings-->
Expand Down
87 changes: 85 additions & 2 deletions tools/find-inactive-collaborators.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,85 @@ async function getCollaboratorsFromReadme() {
return returnedArray;
}

async function moveCollaboratorToEmeritus(peopleToMove) {
const readmeText = readline.createInterface({
input: fs.createReadStream(new URL('../README.md', import.meta.url)),
crlfDelay: Infinity,
});
let fileContents = '';
let inCollaboratorsSection = false;
let inCollaboratorEmeritusSection = false;
let collaboratorFirstLine = '';
const textToMove = [];
for await (const line of readmeText) {
// If we've been processing collaborator emeriti and we reach the end of
// the list, print out the remaining entries to be moved because they come
// alphabetically after the last item.
if (inCollaboratorEmeritusSection && line === '' &&
fileContents.endsWith('&gt;\n')) {
while (textToMove.length) {
fileContents += textToMove.pop();
}
}

// If we've found the collaborator heading already, stop processing at the
// next heading.
if (line.startsWith('#')) {
inCollaboratorsSection = false;
inCollaboratorEmeritusSection = false;
}

const isCollaborator = inCollaboratorsSection && line.length;
const isCollaboratorEmeritus = inCollaboratorEmeritusSection && line.length;

if (line === '### Collaborators') {
inCollaboratorsSection = true;
}
if (line === '### Collaborator emeriti') {
inCollaboratorEmeritusSection = true;
}

if (isCollaborator) {
if (line.startsWith('* ')) {
collaboratorFirstLine = line;
} else if (line.startsWith('**')) {
const [, name, email] = /^\*\*([^*]+)\*\* &lt;(.+)&gt;/.exec(line);
if (peopleToMove.some((entry) => {
return entry.name === name && entry.email === email;
})) {
textToMove.push(`${collaboratorFirstLine}\n${line}\n`);
} else {
fileContents += `${collaboratorFirstLine}\n${line}\n`;
}
} else {
fileContents += `${line}\n`;
}
}

if (isCollaboratorEmeritus) {
if (line.startsWith('* ')) {
collaboratorFirstLine = line;
} else if (line.startsWith('**')) {
const currentLine = `${collaboratorFirstLine}\n${line}\n`;
// If textToMove is empty, this still works because when undefined is
// used in a comparison with <, the result is always false.
while (textToMove[0] < currentLine) {
fileContents += textToMove.shift();
}
fileContents += currentLine;
} else {
fileContents += `${line}\n`;
}
}

if (!isCollaborator && !isCollaboratorEmeritus) {
fileContents += `${line}\n`;
}
}

return fileContents;
}

// Get list of current collaborators from README.md.
const collaborators = await getCollaboratorsFromReadme();

Expand All @@ -113,9 +192,13 @@ const inactive = collaborators.filter((collaborator) =>
!authors.has(collaborator.mailmap) &&
!landers.has(collaborator.mailmap) &&
!approvingReviewers.has(collaborator.name)
).map((collaborator) => collaborator.name);
);

if (inactive.length) {
console.log('\nInactive collaborators:\n');
console.log(inactive.map((name) => `* ${name}`).join('\n'));
console.log(inactive.map((entry) => `* ${entry.name}`).join('\n'));
console.log('\nGenerating new README.md file...');
const newReadmeText = await moveCollaboratorToEmeritus(inactive);
fs.writeFileSync(new URL('../README.md', import.meta.url), newReadmeText);
console.log('Updated README.md generated. Please commit these changes.');
}