File tree 2 files changed +46
-0
lines changed
tools/node-lint-md-cli-rollup/src
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,16 @@ jobs:
50
50
node-version : ${{ env.NODE_VERSION }}
51
51
- name : Environment Information
52
52
run : npx envinfo
53
+ - name : Get release version numbers
54
+ id : get-released-versions
55
+ run : ./tools/node-lint-md-cli-rollup/src/list-released-versions-from-changelogs.mjs
53
56
- name : Lint docs
54
57
run : |
55
58
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
56
59
NODE=$(command -v node) make lint-md
60
+ env :
61
+ NODE_RELEASED_VERSIONS : ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}
62
+
57
63
lint-js :
58
64
if : github.event.pull_request.draft == false
59
65
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'node:fs' ;
4
+ import { createInterface } from 'node:readline' ;
5
+
6
+ const dataFolder = new URL ( '../../../doc/changelogs/' , import . meta. url ) ;
7
+
8
+ const result = [ ] ;
9
+ async function getVersionsFromFile ( file ) {
10
+ const input = fs . createReadStream ( file ) ;
11
+ let toc = false ;
12
+ for await ( const line of createInterface ( {
13
+ input,
14
+ crlfDelay : Infinity ,
15
+ } ) ) {
16
+ if ( toc === false && line === '<table>' ) {
17
+ toc = true ;
18
+ } else if ( toc && line [ 0 ] !== '<' ) {
19
+ input . close ( ) ;
20
+ return ;
21
+ } else if ( toc && line . startsWith ( '<a' ) ) {
22
+ result . push ( line . slice ( line . indexOf ( '>' ) + 1 , - '</a><br/>' . length ) ) ;
23
+ }
24
+ }
25
+ }
26
+
27
+ const filesToCheck = [ ] ;
28
+
29
+ const dir = await fs . promises . opendir ( dataFolder ) ;
30
+ for await ( const dirent of dir ) {
31
+ if ( dirent . isFile ( ) ) {
32
+ filesToCheck . push (
33
+ getVersionsFromFile ( new URL ( `./${ dirent . name } ` , dataFolder ) )
34
+ ) ;
35
+ }
36
+ }
37
+
38
+ await Promise . all ( filesToCheck ) ;
39
+
40
+ console . log ( `::set-output name=NODE_RELEASED_VERSIONS::${ result . join ( ',' ) } ` ) ;
You can’t perform that action at this time.
0 commit comments