-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(lint): refactor & handle more errors (#330)
- Loading branch information
1 parent
17c647d
commit 610e977
Showing
7 changed files
with
239 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,7 @@ | |
"imports": { | ||
"@/": "./", | ||
"std/": "https://deno.land/[email protected]/", | ||
|
||
"catppuccin-repo/": "https://raw.githubusercontent.com/catppuccin/catppuccin/91d6b5433730103c504dcf43583b594e418ee7c1/", | ||
"globber": "https://deno.land/x/[email protected]/mod.ts", | ||
|
||
"@actions/core": "npm:@actions/[email protected]", | ||
"@octokit/rest": "npm:@octokit/[email protected]", | ||
"usercss-meta": "npm:[email protected]", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { exists } from "std/fs/mod.ts"; | ||
import { join, relative } from "std/path/mod.ts"; | ||
import core from "@actions/core"; | ||
|
||
import { REPO_ROOT } from "@/deps.ts"; | ||
import { log } from "./logger.ts"; | ||
import chalk from "chalk"; | ||
|
||
const requiredFiles = [ | ||
"catppuccin.user.css", | ||
...["latte", "frappe", "macchiato", "mocha", "catwalk"].map((f) => | ||
join("assets", `${f}.webp`) | ||
), | ||
]; | ||
|
||
export const checkForMissingFiles = async () => { | ||
const stylesRoot = join(REPO_ROOT, "styles"); | ||
|
||
const missingFiles: string[] = []; | ||
for await (const entry of Deno.readDir(stylesRoot)) { | ||
if (!entry.isDirectory) continue; | ||
const styleRoot = join(stylesRoot, entry.name); | ||
|
||
await Promise.all(requiredFiles.map(async (f) => { | ||
const fp = join(styleRoot, f); | ||
const rfp = relative(REPO_ROOT, fp); | ||
|
||
if (!(await exists(fp))) { | ||
missingFiles.push(rfp); | ||
} | ||
})); | ||
} | ||
|
||
// only write summary if running in github actions | ||
if (Deno.env.has("GITHUB_ACTIONS")) { | ||
await core.summary | ||
.addHeading("Missing files") | ||
.addList(missingFiles) | ||
.write(); | ||
} else { | ||
missingFiles.map((f) => { | ||
log(chalk.red(`Missing file:`) + ` ${f}`, { file: f }, "error"); | ||
}); | ||
} | ||
|
||
return missingFiles.length === 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.