Skip to content

Commit

Permalink
🏷️ Fix type bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Apr 20, 2021
1 parent 74597c4 commit 4c9abd1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/calculate-response-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
)
Expand Down
1 change: 1 addition & 0 deletions src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ ${config.summaryEndHtmlComment || "<!--end: status pages-->"}${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)
Expand Down
2 changes: 1 addition & 1 deletion src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const update = async (shouldCommit = false) => {
}[] = [];
for await (const incident of _ongoingMaintenanceEvents.data) {
const metadata: Record<string, string> = {};
if (incident.body.includes("<!--")) {
if (incident.body && incident.body.includes("<!--")) {
const summary = incident.body.split("<!--")[1].split("-->")[0];
const lines = summary
.split("\n")
Expand Down

0 comments on commit 4c9abd1

Please sign in to comment.