import { prepareRunErrorsEmail } from "https://esm.town/v/andreterron/prepareRunErrorsEmail";
import process from "node:process";
import { runs as runs2 } from "https://esm.town/v/stevekrouse/runs?v=17";
export const myRunsFailed = async (interval: Interval) => {
if (!interval.lastRunAt) {
return;
}
const runs = await runs2({
token: process.env.vt_token,
error: true,
source: ["api", "interval"],
since: interval.lastRunAt,
});
if (runs?.data?.length ?? 0 > 0) {
console.email({
html: prepareRunErrorsEmail(runs.data),
}, "Your val executions resulted in errors");
}
return runs;
};