Skip to content

Commit

Permalink
fixup! tools: add workflow to ensure README lists are in sync with …
Browse files Browse the repository at this point in the history
…gh teams
  • Loading branch information
aduh95 committed Jul 17, 2024
1 parent 7d5bb3b commit 5370926
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/linters-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: Linters (README.md)

on:
# We need `pull_request_target` to access the secrets
# We need `pull_request_target`, because forks won't have access to team members.
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
paths: [README.md]
Expand All @@ -15,10 +15,6 @@ 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

Expand Down
15 changes: 10 additions & 5 deletions tools/lint-readme-lists.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ for await (const line of readme.readLines()) {
previousGithubHandle = currentGithubHandleLowerCase;
}
}
console.info('Lists are in the alphabetical order.');

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));
if (argv[2]) {
const reviver = (_, value) =>
(typeof value === 'string' && value[0] === '[' && value.at(-1) === ']' ?
new Set(JSON.parse(value)) :
value);
assert.deepStrictEqual(JSON.parse(argv[2], reviver), { ...actualMembers });
} else {
console.warn('Skipping the check of GitHub teams membership.');
}

0 comments on commit 5370926

Please sign in to comment.