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
2 changes: 1 addition & 1 deletion src/app/api/metrics/languages/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
const data = await withMetricsCache({ bypass, key, ttlSeconds: METRICS_CACHE_TTL_SECONDS.languages }, async () => {
const headers = { Authorization: `Bearer ${token}`, Accept: "application/vnd.github+json" };
const since = new Date();
const rawDays = parseInt(req.nextUrl.searchParams.get("days") ?? "90", 10); const days = Number.isFinite(rawDays) && rawDays > 0 ? Math.min(rawDays, 365) : 90;
const rawDays = parseInt(req.nextUrl.searchParams.get("days", 10) ?? "90", 10); const days = Number.isFinite(rawDays) && rawDays > 0 ? Math.min(rawDays, 365) : 90;

Check failure on line 59 in src/app/api/metrics/languages/route.ts

View workflow job for this annotation

GitHub Actions / Type check

Expected 1 arguments, but got 2.

const searchRes = await fetch(
`${GITHUB_API}/search/commits?q=author:${githubLogin}+author-date:>=${since.toISOString().slice(0, 10)}&per_page=100&sort=author-date&order=desc`,
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/metrics/prs/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async function fetchPRMetrics(
const open = data.items.filter((pr) => pr.state === "open").length;
const mergedPRs = data.items.filter((pr) => pr.pull_request?.merged_at != null);
const merged = mergedPRs.length;
const closed = data.items.filter((pr) => pr.state === "closed" && pr.pull_request?.merged_at == null).length;
const closed = data.items.filter((pr) => pr.state === "closed" && pr.pull_request?.merged_at === null).length;

const avgReviewMs = mergedPRs.length > 0
? mergedPRs.reduce((sum, pr) => sum + (new Date(pr.closed_at!).getTime() - new Date(pr.created_at).getTime()), 0) / mergedPRs.length
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/metrics/repo-health/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
return Response.json({ error: "Unauthorized" }, { status: 401 });
}

const requestedDays = parseInt(req.nextUrl.searchParams.get("days") ?? "30", 10);
const requestedDays = parseInt(req.nextUrl.searchParams.get("days", 10) ?? "30", 10);

Check failure on line 153 in src/app/api/metrics/repo-health/route.ts

View workflow job for this annotation

GitHub Actions / Type check

Expected 1 arguments, but got 2.
// Only allow 7, 30, or 90 day windows — other values default to 30.
const days = requestedDays === 7 || requestedDays === 30 || requestedDays === 90 ? requestedDays : 30;

Expand Down
Loading