19
19
20
20
/* global argv, path, cd */
21
21
22
- 'use strict'
22
+ import { dirname } from 'path'
23
+ import { fileURLToPath } from 'url'
24
+ import 'zx/globals'
25
+ import assert from 'assert'
26
+ import * as core from '@actions/core'
27
+ import { copyFile } from 'fs/promises'
28
+ import * as github from '@actions/github'
29
+ import specification from '../../output/schema/schema.json' assert { type : 'json ' }
30
+ import { run as getReport } from '../../../clients-flight-recorder/scripts/types-validator/index.js'
31
+ import {
32
+ getNamespace ,
33
+ getName
34
+ } from '../../../clients-flight-recorder/scripts/types-validator/utils.js'
35
+
36
+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
23
37
24
- require ( 'zx/globals' )
25
- const assert = require ( 'assert' )
26
- const core = require ( '@actions/core' )
27
- const { copyFile } = require ( 'fs/promises' )
28
- const github = require ( '@actions/github' )
29
38
const octokit = github . getOctokit ( argv . token )
30
- const specification = require ( '../../output/schema/schema.json' )
31
- const getReport = require ( '../../../clients-flight-recorder/scripts/types-validator' )
32
- const { getNamespace, getName } = require ( '../../../clients-flight-recorder/scripts/types-validator/utils' )
33
39
34
40
const privateNames = [ '_global' ]
35
41
const tick = '`'
36
- const tsValidationPath = path . join ( __dirname , '..' , '..' , '..' , 'clients-flight-recorder' , 'scripts' , 'types-validator' )
37
-
38
- async function run ( ) {
42
+ const tsValidationPath = path . join (
43
+ __dirname ,
44
+ '..' ,
45
+ '..' ,
46
+ '..' ,
47
+ 'clients-flight-recorder' ,
48
+ 'scripts' ,
49
+ 'types-validator'
50
+ )
51
+
52
+ async function run ( ) {
39
53
await copyFile (
40
54
path . join ( __dirname , '..' , '..' , 'output' , 'typescript' , 'types.ts' ) ,
41
55
path . join ( tsValidationPath , 'types.ts' )
@@ -53,14 +67,20 @@ async function run () {
53
67
per_page : 100
54
68
} )
55
69
if ( data . length > 0 ) {
56
- files . push ( ...data . map ( entry => entry . filename ) )
70
+ files . push (
71
+ ...data
72
+ . filter ( ( entry ) => entry . status !== 'deleted' )
73
+ . map ( ( entry ) => entry . filename )
74
+ )
57
75
page += 1
58
76
} else {
59
77
break
60
78
}
61
79
}
62
80
63
- const specFiles = files . filter ( file => file . includes ( 'specification' ) && ! file . includes ( 'compiler/test' ) )
81
+ const specFiles = files . filter (
82
+ ( file ) => file . includes ( 'specification' ) && ! file . includes ( 'compiler/test' )
83
+ )
64
84
const table = [ ]
65
85
66
86
cd ( tsValidationPath )
@@ -163,7 +183,7 @@ function generateResponse (r) {
163
183
return `${ r . passingResponse } /${ r . totalResponse } `
164
184
}
165
185
166
- run ( ) . catch ( err => {
186
+ run ( ) . catch ( ( err ) => {
167
187
core . error ( err )
168
188
process . exit ( 1 )
169
189
} )
0 commit comments