Skip to content

Commit 505dd6b

Browse files
authored
ci: Fix flaky definitions check (#8504)
1 parent fc81b41 commit 505dd6b

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

ci/definitionsCheck.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
const fs = require('fs').promises;
22
const { exec } = require('child_process');
33
const core = require('@actions/core');
4-
const { nextTick } = require('process');
5-
const { AbortController } = require("node-abort-controller");
4+
const util = require('util');
65
(async () => {
76
const [currentDefinitions, currentDocs] = await Promise.all([
87
fs.readFile('./src/Options/Definitions.js', 'utf8'),
98
fs.readFile('./src/Options/docs.js', 'utf8'),
109
]);
11-
exec('npm run definitions');
12-
const ac = new AbortController();
13-
const { signal } = ac;
14-
const watcher = fs.watch('./src/Options/docs.js', {signal});
15-
let i = 0;
16-
// eslint-disable-next-line
17-
for await (const _ of watcher) {
18-
i++;
19-
if (i === 3) {
20-
ac.abort();
21-
break;
22-
}
23-
}
24-
await new Promise(resolve => nextTick(resolve));
10+
const execute = util.promisify(exec);
11+
await execute('npm run definitions');
2512
const [newDefinitions, newDocs] = await Promise.all([
2613
fs.readFile('./src/Options/Definitions.js', 'utf8'),
2714
fs.readFile('./src/Options/docs.js', 'utf8'),

0 commit comments

Comments
 (0)