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

Update README.md #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
54 changes: 54 additions & 0 deletions .github/workflows/linters-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# We need a separate workflow file so failures on the README are not reported on
# all PRs, only on the ones that update the README.
name: Linters (README.md)

on:
# We need `pull_request_target` to access the secrets
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
paths: [README.md]
push:
branches:
- main
- v[0-9]+.x-staging
- v[0-9]+.x

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
PYTHON_VERSION: '3.12'
NODE_VERSION: lts/*

permissions:
contents: read

jobs:
lint-readme-lists:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
ref: ${{ github.event.repository.default_branch }}
- name: Get team members
id: team_members
run: |
get_list_members() {
TEAM="$1"
QUOTE='"'
gh api "/orgs/nodejs/teams/$TEAM/members" -X GET -f per_page=100 --jq "map(.login) | ${QUOTE}${TEAM}=\(tojson)${QUOTE}"
}

get_list_members "collaborators" >> "$GITHUB_OUTPUT"
get_list_members "issue-triage" >> "$GITHUB_OUTPUT"
get_list_members "tsc" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
- name: Get modified README
if: github.event_name != 'push'
run: curl -fsSLo README.md "https://raw.githubusercontent.com/nodejs/node/$GITHUB_SHA/README.md"
- run: tools/lint-readme-lists.mjs "$TEAMS"
env:
TEAMS: ${{ tojson(steps.team_members.outputs) }}
7 changes: 0 additions & 7 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,3 @@ jobs:
persist-credentials: false
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
lint-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- run: tools/lint-readme-lists.mjs
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ For information about the governance of the Node.js project, see
**Marco Ippolito** <<[email protected]>> (he/him)
* [marsonya](https://github.com/marsonya) -
**Akhil Marsonya** <<[email protected]>> (he/him)
* [MattiasBuelens](https://github.com/MattiasBuelens) -
**Mattias Buelens** <<[email protected]>> (he/him)
* [mcollina](https://github.com/mcollina) -
**Matteo Collina** <<[email protected]>> (he/him)
* [meixg](https://github.com/meixg) -
Expand Down Expand Up @@ -735,20 +737,18 @@ maintaining the Node.js project.
**Daeyeon Jeong** <<[email protected]>> (he/him)
* [F3n67u](https://github.com/F3n67u) -
**Feng Yu** <<[email protected]>> (he/him)
* [himadriganguly](https://github.com/himadriganguly) -
**Himadri Ganguly** <<himadri.tech@gmail.com>> (he/him)
* [gireeshpunathil](https://github.com/gireeshpunathil) -
**Gireesh Punathil** <<[email protected].com>> (he/him)
* [iam-frankqiu](https://github.com/iam-frankqiu) -
**Frank Qiu** <<[email protected]>> (he/him)
* [kvakil](https://github.com/kvakil) -
**Keyhan Vakil** <<[email protected]>>
* [marsonya](https://github.com/marsonya) -
**Akhil Marsonya** <<[email protected]>> (he/him)
* [meixg](https://github.com/meixg) -
**Xuguang Mei** <<[email protected]>> (he/him)
* [mertcanaltin](https://github.com/mertcanaltin) -
**Mert Can Altin** <<[email protected]>>
* [Mesteery](https://github.com/Mesteery) -
**Mestery** <<[email protected]>> (he/him)
* [PoojaDurgad](https://github.com/PoojaDurgad) -
**Pooja Durgad** <<[email protected]>>
* [preveen-stack](https://github.com/preveen-stack) -
**Preveen Padmanabhan** <<[email protected]>> (he/him)
* [RedYetiDev](https://github.com/redyetidev) -
Expand Down
49 changes: 31 additions & 18 deletions tools/lint-readme-lists.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

// Validates the list in the README are in the correct order.

import assert from 'node:assert';
import { open } from 'node:fs/promises';

const lists = [
'TSC voting members',
'TSC regular members',
'TSC emeriti members',
'Collaborators',
'Collaborator emeriti',
'Triagers',
];
import { argv } from 'node:process'

const lists = {
__proto__: null,
'TSC voting members': 'tsc',
'TSC regular members': null,
'TSC emeriti members': null,
'Collaborators': 'collaborators',
'Collaborator emeriti': null,
'Triagers': 'issue-triage'
};
const actualMembers = {
__proto__: null,
// The bot is part of `@nodejs/collaborators`, but is not listed in the README.
'collaborators': new Set().add('nodejs-github-bot'),
};
const tscMembers = new Set();

const readme = await open(new URL('../README.md', import.meta.url), 'r');
Expand All @@ -23,14 +31,15 @@ let lineNumber = 0;
for await (const line of readme.readLines()) {
lineNumber++;
if (line.startsWith('### ')) {
currentList = lists[lists.indexOf(line.slice(4))];
currentList = line.slice(4);
previousGithubHandle = null;
} else if (line.startsWith('#### ')) {
currentList = lists[lists.indexOf(line.slice(5))];
currentList = line.slice(5);
previousGithubHandle = null;
} else if (currentList && line.startsWith('* [')) {
const currentGithubHandle = line.slice(3, line.indexOf(']')).toLowerCase();
if (previousGithubHandle && previousGithubHandle >= currentGithubHandle) {
} else if (currentList in lists && line.startsWith('* [')) {
const currentGithubHandle = line.slice(3, line.indexOf(']'));
const currentGithubHandleLowerCase = currentGithubHandle.toLowerCase();
if (previousGithubHandle && previousGithubHandle >= currentGithubHandleLowerCase) {
throw new Error(`${currentGithubHandle} should be listed before ${previousGithubHandle} in the ${currentList} list (README.md:${lineNumber})`);
}

Expand All @@ -39,10 +48,14 @@ for await (const line of readme.readLines()) {
} else if (currentList === 'Collaborators') {
tscMembers.delete(currentGithubHandle);
}
previousGithubHandle = currentGithubHandle;
if (lists[currentList]) {
(actualMembers[lists[currentList]] ??= new Set).add(currentGithubHandle);
}
previousGithubHandle = currentGithubHandleLowerCase;
}
}

if (tscMembers.size !== 0) {
throw new Error(`Some TSC members are not listed as Collaborators: ${Array.from(tscMembers)}`);
}
assert.deepStrictEqual(tscMembers, new Set, `Some TSC members are not listed as Collaborators`);

const reviver = (_, value) => typeof value === 'string' && value[0] === '[' && value.at(-1) === ']' ? new Set(JSON.parse(value)) : value;
assert.deepStrictEqual({...actualMembers}, JSON.parse(argv[2], reviver))
Loading