-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { RepoSummary } from "@lib/repo-summaries"; | ||
import { groupBySlo } from "@lib/slo"; | ||
import type { | ||
APIRoute, | ||
GetStaticPaths, | ||
InferGetStaticPropsType | ||
} from "astro"; | ||
|
||
export const getStaticPaths = (async () => { | ||
const repos = RepoSummary.array().parse( | ||
Object.values(await import.meta.glob("../../../../scanner/summaries/*/*.json", { eager: true })) | ||
); | ||
return repos.map((repo) => ({ | ||
params: { org: repo.org, repo: repo.repo }, | ||
props: { details: repo }, | ||
})); | ||
}) satisfies GetStaticPaths; | ||
|
||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
|
||
export const GET: APIRoute = ({ props }) => { | ||
const { details } = props as Props; | ||
const groups = groupBySlo(details.issues); | ||
return new Response( | ||
JSON.stringify({ | ||
triageViolations: groups.triageViolations.length, | ||
urgentViolations: groups.urgentViolations.length, | ||
importantViolations: groups.importantViolations.length, | ||
needTriage: groups.untriaged.length, | ||
urgent: groups.urgent.length, | ||
important: groups.important.length, | ||
other: groups.other.length, | ||
})); | ||
} |
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