From 5a6ed5a9c73dc72dd43a625cfff0f35275429d0e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 15:42:24 +0200 Subject: [PATCH 1/9] tools: add a linter for README lists --- .github/workflows/linters.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/linters.yml diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..4f29fa8 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,24 @@ +name: Linters + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint-readme: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + persist-credentials: false + - run: tools/lint-readme-lists.mjs From 749c4a0de736f757101c6faa3c0ca0cf63137820 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:00:10 +0000 Subject: [PATCH 2/9] add script --- tools/lint-readme-lists.mjs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tools/lint-readme-lists.mjs diff --git a/tools/lint-readme-lists.mjs b/tools/lint-readme-lists.mjs new file mode 100755 index 0000000..7545f43 --- /dev/null +++ b/tools/lint-readme-lists.mjs @@ -0,0 +1,29 @@ +#!/usr/bin/env node + +// Validates the list in the README are in the correct order. + +import { open } from 'node:fs/promises'; + +const [,,markdownFile] = process.argv; + +const readme = await open(markdownFile, 'r'); + +let currentList = null; +let previousGithubHandle; +let lineNumber = 0; + +for await (const line of readme.readLines()) { + lineNumber++; + if (line.startsWith('##')) { + currentList = line.slice(line.indexOf(' ')); + previousGithubHandle = null; + } else if (currentList && (line.startsWith('- [') || line.startsWith('* ['))) { + const currentGithubHandle = line.slice(3, line.indexOf(']')).toLowerCase(); + if (previousGithubHandle && previousGithubHandle >= currentGithubHandle) { + throw new Error(`${currentGithubHandle} should be listed before ${previousGithubHandle} in the ${currentList} list (${markdownFile}:${lineNumber})`); + } + + previousGithubHandle = currentGithubHandle; + } +} + From 697ab973712f188369cf6de2e155c5bf421ddd21 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:00:29 +0000 Subject: [PATCH 3/9] order lists --- .github/workflows/linters.yml | 17 ++++++++++++++++- Moderation-Policy.md | 10 ++++++---- README.md | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 4f29fa8..461cd5d 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -3,9 +3,17 @@ name: Linters on: pull_request: types: [opened, synchronize, reopened, ready_for_review] + paths: + - README.md + - Moderation-Policy.md + - .github/workflows/linters.yml push: branches: - main + paths: + - README.md + - Moderation-Policy.md + - .github/workflows/linters.yml concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -17,8 +25,15 @@ permissions: jobs: lint-readme: runs-on: ubuntu-latest + strategy: + matrix: + file: + - README.md + - Moderation-Policy.md steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: persist-credentials: false - - run: tools/lint-readme-lists.mjs + - run: tools/lint-readme-lists.mjs "$FILE" + env: + FILE: ${{ matrix.file }} diff --git a/Moderation-Policy.md b/Moderation-Policy.md index fe70289..174421c 100644 --- a/Moderation-Policy.md +++ b/Moderation-Policy.md @@ -294,6 +294,7 @@ remove resigning team member from respective permissions and private access. ### Current Members of Moderation Team + * [aduh95](https://github.com/aduh95) - **Antoine du Hamel** <> (he/him) * [benjamingr](https://github.com/benjamingr) - @@ -309,16 +310,17 @@ remove resigning team member from respective permissions and private access. ### Admins for Node.js Slack community + * [alextes](https://github.com/alextes) - **Alexander Tesfamichael** <alex.tesfamichael@gmail.com> * [aredridel](https://github.com/aredridel) - **Aria Stewart** <aredridel@dinhe.net> -* [ljharb](https://github.com/ljharb) - -**Jordan Harband** <ljharb@gmail.com> -* [jxm262](https://github.com/jxm262) - -**Justin Maat** <jxm262@gmail.com> * [hackygolucky](https://github.com/hackygolucky) - **Tracy Hinds** <tracyhinds@gmail.com> +* [jxm262](https://github.com/jxm262) - +**Justin Maat** <jxm262@gmail.com> +* [ljharb](https://github.com/ljharb) - +**Jordan Harband** <ljharb@gmail.com> ## Escalation of Issues diff --git a/README.md b/README.md index 62af604..caf864b 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ action requiring consensus and voting will abide by the TSC process for that. ### Contacts for assistance -- [@mhdawson](https://github.com/mhdawson) - **Michael Dawson**, TSC Chair - [@mcollina](https://github.com/mcollina) - **Matteo Collina**, TSC Vice Chair +- [@mhdawson](https://github.com/mhdawson) - **Michael Dawson**, TSC Chair ### Admin members From 5e000953516b89a0c30f319af1162fc031b5fc03 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 16:02:39 +0200 Subject: [PATCH 4/9] Update .github/workflows/linters.yml --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 461cd5d..786dcd5 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -23,7 +23,7 @@ permissions: contents: read jobs: - lint-readme: + lint-md-lists: runs-on: ubuntu-latest strategy: matrix: From 53ab04b945e69c536723c6495ffacf196721ac91 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 16:04:21 +0200 Subject: [PATCH 5/9] Update tools/lint-readme-lists.mjs --- tools/lint-readme-lists.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lint-readme-lists.mjs b/tools/lint-readme-lists.mjs index 7545f43..b5a7722 100755 --- a/tools/lint-readme-lists.mjs +++ b/tools/lint-readme-lists.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node -// Validates the list in the README are in the correct order. +// Validates the list in the markdown file passed as CLI argument are in the correct order. import { open } from 'node:fs/promises'; From 00aa19305c4f053905e1744454e37d0ce5e8dc2a Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:05:46 +0000 Subject: [PATCH 6/9] revert MD changes to ensure errors are reported --- Moderation-Policy.md | 10 ++++------ README.md | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Moderation-Policy.md b/Moderation-Policy.md index 174421c..fe70289 100644 --- a/Moderation-Policy.md +++ b/Moderation-Policy.md @@ -294,7 +294,6 @@ remove resigning team member from respective permissions and private access. ### Current Members of Moderation Team - * [aduh95](https://github.com/aduh95) - **Antoine du Hamel** <> (he/him) * [benjamingr](https://github.com/benjamingr) - @@ -310,17 +309,16 @@ remove resigning team member from respective permissions and private access. ### Admins for Node.js Slack community - * [alextes](https://github.com/alextes) - **Alexander Tesfamichael** <alex.tesfamichael@gmail.com> * [aredridel](https://github.com/aredridel) - **Aria Stewart** <aredridel@dinhe.net> -* [hackygolucky](https://github.com/hackygolucky) - -**Tracy Hinds** <tracyhinds@gmail.com> -* [jxm262](https://github.com/jxm262) - -**Justin Maat** <jxm262@gmail.com> * [ljharb](https://github.com/ljharb) - **Jordan Harband** <ljharb@gmail.com> +* [jxm262](https://github.com/jxm262) - +**Justin Maat** <jxm262@gmail.com> +* [hackygolucky](https://github.com/hackygolucky) - +**Tracy Hinds** <tracyhinds@gmail.com> ## Escalation of Issues diff --git a/README.md b/README.md index caf864b..62af604 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ action requiring consensus and voting will abide by the TSC process for that. ### Contacts for assistance -- [@mcollina](https://github.com/mcollina) - **Matteo Collina**, TSC Vice Chair - [@mhdawson](https://github.com/mhdawson) - **Michael Dawson**, TSC Chair +- [@mcollina](https://github.com/mcollina) - **Matteo Collina**, TSC Vice Chair ### Admin members From 3fe5de1165199d5ddbdf0979fcb5570e0ed0e1b9 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:07:20 +0000 Subject: [PATCH 7/9] do not cancel-in-progress --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 786dcd5..77723d7 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -17,7 +17,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true + cancel-in-progress: false permissions: contents: read From 45d4feb1925f9df0a72e4ec4524c2f966ea0760c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:08:34 +0000 Subject: [PATCH 8/9] Revert "revert MD changes to ensure errors are reported" This reverts commit 00aa19305c4f053905e1744454e37d0ce5e8dc2a. --- Moderation-Policy.md | 10 ++++++---- README.md | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Moderation-Policy.md b/Moderation-Policy.md index fe70289..174421c 100644 --- a/Moderation-Policy.md +++ b/Moderation-Policy.md @@ -294,6 +294,7 @@ remove resigning team member from respective permissions and private access. ### Current Members of Moderation Team + * [aduh95](https://github.com/aduh95) - **Antoine du Hamel** <> (he/him) * [benjamingr](https://github.com/benjamingr) - @@ -309,16 +310,17 @@ remove resigning team member from respective permissions and private access. ### Admins for Node.js Slack community + * [alextes](https://github.com/alextes) - **Alexander Tesfamichael** <alex.tesfamichael@gmail.com> * [aredridel](https://github.com/aredridel) - **Aria Stewart** <aredridel@dinhe.net> -* [ljharb](https://github.com/ljharb) - -**Jordan Harband** <ljharb@gmail.com> -* [jxm262](https://github.com/jxm262) - -**Justin Maat** <jxm262@gmail.com> * [hackygolucky](https://github.com/hackygolucky) - **Tracy Hinds** <tracyhinds@gmail.com> +* [jxm262](https://github.com/jxm262) - +**Justin Maat** <jxm262@gmail.com> +* [ljharb](https://github.com/ljharb) - +**Jordan Harband** <ljharb@gmail.com> ## Escalation of Issues diff --git a/README.md b/README.md index 62af604..caf864b 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ action requiring consensus and voting will abide by the TSC process for that. ### Contacts for assistance -- [@mhdawson](https://github.com/mhdawson) - **Michael Dawson**, TSC Chair - [@mcollina](https://github.com/mcollina) - **Matteo Collina**, TSC Vice Chair +- [@mhdawson](https://github.com/mhdawson) - **Michael Dawson**, TSC Chair ### Admin members From ebdd51af235fd1d31558dbd3cd25e80115e25efe Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 10 Jul 2024 14:11:44 +0000 Subject: [PATCH 9/9] do not fail-fast --- .github/workflows/linters.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 77723d7..c3d7474 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -26,6 +26,7 @@ jobs: lint-md-lists: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: file: - README.md