Skip to content

Commit 77d0245

Browse files
committed
Try to find estimates.json files
1 parent 0f65876 commit 77d0245

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

index.js

+28-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,36 @@ try {
1717
const payload = JSON.stringify(github.context.payload, undefined, 2);
1818
console.log(`The event payload: ${payload}`);
1919

20-
fs.readFile("examples/criterion/limbo/Execute\ prepared\ statement_\ \'SELECT\ 1\'/new/estimates.json", "utf8", (err, data) => {
21-
if (err) {
22-
console.error(err);
23-
return;
20+
// Find all estimates.json files in any 'new' subdirectories of the 'examples' directory
21+
const estimates = [];
22+
const walkSync = (dir, filelist = []) => {
23+
fs.readdirSync(dir).forEach((file) => {
24+
const path = require("path");
25+
file.isDirectory()
26+
? (filelist = walkSync(path.join(dir, file), filelist))
27+
: filelist.push(path.join(dir, file));
28+
});
29+
return filelist;
30+
};
31+
const files = walkSync("examples");
32+
files.forEach((file) => {
33+
if (file.includes("estimates.json")) {
34+
estimates.push(file);
2435
}
25-
console.log(data);
2636
});
37+
console.log(estimates);
38+
39+
fs.readFile(
40+
"examples/criterion/limbo/Execute prepared statement_ 'SELECT 1'/new/estimates.json",
41+
"utf8",
42+
(err, data) => {
43+
if (err) {
44+
console.error(err);
45+
return;
46+
}
47+
console.log(data);
48+
}
49+
);
2750
} catch (error) {
2851
core.setFailed(error.message);
2952
}

0 commit comments

Comments
 (0)