mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-22 15:28:12 +00:00
fix(ci): reject empty timing job payloads
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -54,6 +54,18 @@ describe("scripts/ci-run-timings.mjs", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("rejects empty CI job payloads instead of printing empty timing evidence", () => {
|
||||
expect(() =>
|
||||
summarizeRunTimings({
|
||||
conclusion: "success",
|
||||
createdAt: "2026-04-22T10:00:00Z",
|
||||
jobs: [],
|
||||
status: "completed",
|
||||
updatedAt: "2026-04-22T10:01:30Z",
|
||||
}),
|
||||
).toThrow("CI run timing summary requires at least one job");
|
||||
});
|
||||
|
||||
it("selects the push CI run for the current main SHA", () => {
|
||||
expect(
|
||||
selectLatestMainPushCiRun(
|
||||
|
||||
Reference in New Issue
Block a user