From 4c9abd13907619736a5e388e1ed80ec36dc9da24 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 20 Apr 2021 08:45:29 +0200 Subject: [PATCH] :label: Fix type bugs --- src/dependencies.ts | 4 ++-- src/helpers/calculate-response-time.ts | 4 ++-- src/summary.ts | 1 + src/update.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dependencies.ts b/src/dependencies.ts index 794b4071..dd8b57a3 100644 --- a/src/dependencies.ts +++ b/src/dependencies.ts @@ -70,8 +70,8 @@ export const updateDependencies = async () => { owner, repo, path: "README.md", - content: contents.data.content, - sha: contents.data.sha, + content: (contents.data as any).content, + sha: (contents.data as any).sha, message: ":package: Release dependency updates", }); } diff --git a/src/helpers/calculate-response-time.ts b/src/helpers/calculate-response-time.ts index de700525..8466656f 100644 --- a/src/helpers/calculate-response-time.ts +++ b/src/helpers/calculate-response-time.ts @@ -27,7 +27,7 @@ const getHistoryItems = async ( let data = results.data; if ( data.length === 100 && - !dayjs(data[0].commit.author.date).isBefore(dayjs().subtract(1, "year")) + !dayjs((data[0].commit.author || {}).date).isBefore(dayjs().subtract(1, "year")) ) data.push(...(await getHistoryItems(octokit, owner, repo, slug, page + 1))); return data; @@ -56,7 +56,7 @@ export const getResponseTimeForSite = async ( .map( (item) => [ - item.commit.author.date, + (item.commit.author || {}).date, parseInt(item.commit.message.split(" in ")[1].split("ms")[0].trim()), ] as [string, number] ) diff --git a/src/summary.ts b/src/summary.ts index 00897500..dde00802 100644 --- a/src/summary.ts +++ b/src/summary.ts @@ -346,6 +346,7 @@ ${config.summaryEndHtmlComment || ""}${endText}`; console.log("Found recently closed issues", issuesRecentlyClosed.data.length); for await (const issue of issuesRecentlyClosed.data) { if ( + issue.closed_at && // If this issue was closed within 15 minutes new Date(issue.closed_at).getTime() - new Date(issue.created_at).getTime() < 900000 && // It has 1 comment (the default Upptime one) diff --git a/src/update.ts b/src/update.ts index c30c305e..8047f062 100644 --- a/src/update.ts +++ b/src/update.ts @@ -41,7 +41,7 @@ export const update = async (shouldCommit = false) => { }[] = []; for await (const incident of _ongoingMaintenanceEvents.data) { const metadata: Record = {}; - if (incident.body.includes("")[0]; const lines = summary .split("\n")