summaryrefslogtreecommitdiff
path: root/cgithub
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-03-14 00:35:48 -0400
committerJoe Mou <dev@mou.fo>2026-03-14 00:36:16 -0400
commit4662a229e06468a0805a18c6175bc0fd3a4ea985 (patch)
treed32f85f7f0baaa4a22713ca3ec7ff89da53fe73e /cgithub
parent148272c64a97259ac874c4d8af1a93f197299012 (diff)
Fix tree overviewHtml: use tree.readme instead of overview.overviewFiles
Diffstat (limited to 'cgithub')
-rw-r--r--cgithub/src/scraper.test.ts25
-rw-r--r--cgithub/src/scraper.ts5
2 files changed, 15 insertions, 15 deletions
diff --git a/cgithub/src/scraper.test.ts b/cgithub/src/scraper.test.ts
index ad3ed46..1abab29 100644
--- a/cgithub/src/scraper.test.ts
+++ b/cgithub/src/scraper.test.ts
@@ -38,30 +38,27 @@ describe("GitHub scraper", () => {
});
it("should fetch tree", async () => {
- const data = await getGitHubTree("actions", "deploy-pages", "main", "src");
+ const data = await getGitHubTree("github", "rally", "main", "lib");
- assert.strictEqual(data.repo.owner, "actions");
- assert.strictEqual(data.repo.name, "deploy-pages");
+ assert.strictEqual(data.repo.owner, "github");
+ assert.strictEqual(data.repo.name, "rally");
assert.strictEqual(data.branch, "main");
- assert.strictEqual(data.path, "src");
+ assert.strictEqual(data.path, "lib");
assert.deepStrictEqual(data.items, [
{
- name: "__tests__",
- path: "src/__tests__",
- contentType: "directory",
- },
- {
- name: "internal",
- path: "src/internal",
- contentType: "directory",
+ name: "README.md",
+ path: "lib/README.md",
+ contentType: "file",
},
{
- name: "index.js",
- path: "src/index.js",
+ name: "RallyValidate.js",
+ path: "lib/RallyValidate.js",
contentType: "file",
},
]);
+
+ assert.ok(Object.keys(data.overviewHtml ?? {}).includes("README.md"));
});
it("should fetch text blob", async () => {
diff --git a/cgithub/src/scraper.ts b/cgithub/src/scraper.ts
index ac30259..cd743a0 100644
--- a/cgithub/src/scraper.ts
+++ b/cgithub/src/scraper.ts
@@ -101,6 +101,7 @@ interface CodeViewRepoRoute {
interface CodeViewTreeRoute {
tree: {
items: TreeItem[];
+ readme?: OverviewFile;
};
}
@@ -416,7 +417,9 @@ export async function getGitHubTree(
throw new Error("Could not find tree data in embedded JSON");
}
- return extractGitHub(payload, { items: treeRoute.tree.items });
+ const overviewHtml = extractOverviewHtml(treeRoute.tree.readme ? [treeRoute.tree.readme] : []);
+
+ return extractGitHub(payload, { items: treeRoute.tree.items, overviewHtml });
}
export async function getGitHubBlob(