Skip to content

Commit 1cedd57

Browse files
committed
ci: improve ci tasks
1 parent 0be52be commit 1cedd57

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

scripts/devdocs/update-devdocs.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function run() {
8888
}
8989

9090
// keyword-slug-map
91-
if (!fs.existsSync("./.github/caches/")) fs.mkdirSync("./.github/caches/");
91+
if (!fs.existsSync("./.github/caches/")) fs.mkdirSync("./.github/caches/", { recursive: true });
9292
const beautifiedForBetterDiff = JSON.stringify(allLangs, null, 2);
9393
fs.writeFileSync("./.github/caches/keyword-slug-map.json", beautifiedForBetterDiff);
9494

scripts/manual-docs-searches/build-obsidian-help-index.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ function alfredMatcher(str) {
2929
async function run() {
3030
const docsPages = [];
3131
const officialDocsURL = "https://help.obsidian.md/";
32-
const officialDocsJSON = await getOnlineJson(
33-
"https://api.github.com/repos/obsidianmd/obsidian-docs/git/trees/master?recursive=1",
34-
);
3532
const rawGitHubURL = "https://raw.githubusercontent.com/obsidianmd/obsidian-docs/master/";
33+
const officialDocsTree = "https://api.github.com/repositories/285425357/git/trees/master?recursive=1";
34+
35+
// GUARD
36+
const officialDocsJSON = await getOnlineJson(officialDocsTree);
37+
if (!officialDocsJSON) {
38+
console.error("Could not fetch json from: ", officialDocsTree);
39+
process.exit(1);
40+
}
3641

3742
// OFFICIAL DOCS
3843
const officialDocs = officialDocsJSON.tree.filter(
@@ -46,6 +51,7 @@ async function run() {
4651
const area = doc.path.split("/").slice(1, -1).join("/");
4752
const url = officialDocsURL + doc.path.slice(3, -3).replaceAll(" ", "+");
4853
const title = (doc.path.split("/").pop() || "error").slice(0, -3);
54+
console.info("Indexing: ", title);
4955

5056
docsPages.push({
5157
title: title,
@@ -84,6 +90,7 @@ async function run() {
8490
cache: { seconds: 60 * 60 * 24 * 7, loosereload: true },
8591
};
8692

93+
if (!fs.existsSync("./.github/caches/")) fs.mkdirSync("./.github/caches/", { recursive: true });
8794
const beautifiedForBetterDiff = JSON.stringify(docsJson, null, 2);
8895
fs.writeFileSync("./.github/caches/obsidian-help-index.json", beautifiedForBetterDiff);
8996
}

0 commit comments

Comments
 (0)