-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (25 loc) · 900 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const core = require('@actions/core');
const walk = require('walk');
const path = require('path');
const lint = require('./lint');
const disableChecks = core.getInput('disable-checks', {required: false});
let disabled = [];
if (disableChecks) {
disabled = disableChecks.split(',');
}
const walker = walk.walk(".", {followLinks: false, filters: ["node_modules"]});
const results = [];
walker.on("file", function (root, fileStats, next) {
if (path.extname(fileStats.name) === '.ipynb') {
results.push(lint(path.join(root, fileStats.name), disabled));
}
next();
});
walker.on("end", function () {
if (!results.every(i => i)) {
console.log(`${results.filter(v => !v).length}/${results.length} notebooks need cleaning!`);
core.setFailed('Lint failed');
} else {
console.log(`${results.length}/${results.length} notebooks are clean!`);
}
});