ci(lint): exit with error when issues are found (#419)

This commit is contained in:
uncenter authored and GitHub committed 2023-12-28 02:38:10 +01:00
1 parent 2064cb869e
commit d520b24b53
2 files changed
+14 -9

No files matched your search

+10 -3
View File
@@ -20,6 +20,8 @@ const stylesheets = walk(join(REPO_ROOT, "styles", subDir), {
match: [/\.user.css$/],
});
let failed = false;
for await (const entry of stylesheets) {
const repodir = dirname(entry.path);
const repo = basename(repodir);
@@ -33,8 +35,9 @@ for await (const entry of stylesheets) {
if (!isLess) continue;
// try to compile the less file, report any errors
less.render(content, { lint: true, globalVars }).then().catch(
(err) => {
less.render(content, { lint: true, globalVars }).catch(
(err: Less.RenderError) => {
failed = true;
log(
err.message,
{ file, startLine: err.line, endLine: err.line, content },
@@ -44,10 +47,14 @@ for await (const entry of stylesheets) {
);
// advanced linting with stylelint
await lint(entry, content, flags.fix);
await lint(entry, content, flags.fix).catch(() => failed = true);
}
// if any files are missing, cause the workflow to fail
if (await checkForMissingFiles() === false) {
failed = true;
}
if (failed) {
Deno.exit(1);
}