Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion e2e/landing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ test("dashboard stays protected for unauthenticated users", async ({ page }) =>

await expect(page).toHaveURL(/\/$/);
await expect(page.getByRole("link", { name: "Sign in with GitHub" })).toBeVisible();
});
});

test("landing shows footer", async ({ page }) => {
await page.goto("/");

await expect(page.getByRole("contentinfo")).toBeVisible();
});

test("landing has dashboard link", async ({ page }) => {
await page.goto("/");

await expect(page.getByRole("link", { name: "Dashboard" })).toBeVisible();
});

13 changes: 9 additions & 4 deletions src/app/api/metrics/ci/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ async function fetchCIAnalyticsForAccount(token: string, githubLogin: string): P
const repos = Array.from(repoMap.entries()).map(([name, commits]) => ({ name, commits })).sort((a, b) => b.commits - a.commits).slice(0, 5);

const runsByRepo = await Promise.all(repos.map(async (repo) => {
const res = await fetch(`${GITHUB_API}/repos/${repo.name}/actions/runs?per_page=100&created=>=${toIsoDate(30)}`, { headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github+json" }, cache: "no-store" });
if (res.status === 404 || res.status === 403) return [];
if (!res.ok) throw new Error("API error");
const d = await res.json(); return d.workflow_runs ?? [];
try {
const res = await fetch(`${GITHUB_API}/repos/${repo.name}/actions/runs?per_page=100&created=>=${toIsoDate(30)}`, { headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github+json" }, cache: "no-store" });
if (res.status === 404 || res.status === 403) return [];
if (!res.ok) throw new Error("API error");
const d = await res.json(); return d.workflow_runs ?? [];
} catch (err) {
console.error(`Failed to fetch signals for repo ${repo.name}:`, err);
return [];
}
}));

const runs = runsByRepo.flat().filter((r: WorkflowRun) => r.conclusion);
Expand Down
Loading