diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 06bf14ccc207a7..18d2c1e59eea86 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -47,10 +47,16 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Environment Information run: npx envinfo + - name: Get release version numbers + id: get-released-versions + run: ./tools/node-lint-md-cli-rollup/src/list-released-versions-from-changelogs.mjs - name: Lint docs run: | echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" NODE=$(command -v node) make lint-md + env: + NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }} + lint-js: runs-on: ubuntu-latest steps: diff --git a/tools/node-lint-md-cli-rollup/src/list-released-versions-from-changelogs.mjs b/tools/node-lint-md-cli-rollup/src/list-released-versions-from-changelogs.mjs new file mode 100755 index 00000000000000..f134e122985d85 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/src/list-released-versions-from-changelogs.mjs @@ -0,0 +1,40 @@ +#!/usr/bin/env node + +import fs from 'node:fs'; +import { createInterface } from 'node:readline'; + +const dataFolder = new URL('../../../doc/changelogs/', import.meta.url); + +const result = []; +async function getVersionsFromFile(file) { + const input = fs.createReadStream(file); + let toc = false; + for await (const line of createInterface({ + input, + crlfDelay: Infinity, + })) { + if (toc === false && line === '