fix(ci): reject empty timing job payloads

This commit is contained in:
Vincent Koc
2026-06-06 21:22:55 +02:00
parent 6ce5182522
commit 15cb26e6cb
2 changed files with 18 additions and 0 deletions

View File

@@ -127,6 +127,9 @@ function collectRunTimingContext(run) {
*/
export function summarizeRunTimings(run, limit = 15) {
const { created, jobs, updated } = collectRunTimingContext(run);
if (jobs.length === 0) {
throw new Error("CI run timing summary requires at least one job");
}
const byDuration = [...jobs]
.filter((job) => job.durationSeconds !== null)
.toSorted((left, right) => right.durationSeconds - left.durationSeconds)
@@ -312,6 +315,9 @@ function loadRun(runId) {
function summarizeJobs(run) {
const { created, jobs, updated } = collectRunTimingContext(run);
if (jobs.length === 0) {
throw new Error("CI run timing summary requires at least one job");
}
const completedJobs = jobs.filter((job) => job.started !== null && job.completed !== null);
const successfulDurations = jobs
.filter((job) => job.status === "completed" && job.conclusion === "success")