in src/glitch/wakeup.js [34:44]
async function isNotificationNeeded() {
const failedActionRuns = await fetch('https://api.github.com/repos/apache/echarts-bot/actions/workflows/8490751/runs?status=failure&per_page=1')
.then(res => res.json());
const latestFailedRun = failedActionRuns.workflow_runs[0];
if (!latestFailedRun) {
return true
}
const lastFailedTs = Date.parse(latestFailedRun.run_started_at);
// send notification when the failure last for one hour and more
return Date.now() - lastFailedTs >= 60 * 60 * 1e3;
}