Skip to content

Commit

Permalink
Gracefully handle PR events for authors that are potentially deleted …
Browse files Browse the repository at this point in the history
…from GitHub
  • Loading branch information
rithviknishad committed Dec 12, 2024
1 parent 21a7beb commit 492a1cd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scraper/src/github-scraper/parseEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ export const parseEvents = async (events: IGitHubEvent[]) => {
event.payload.action === "closed" &&
event.payload.pull_request?.merged
) {
const turnaroundTime = await calculateTurnaroundTime(event);
let turnaroundTime: number | undefined = undefined;
try {
turnaroundTime = await calculateTurnaroundTime(event);
} catch (e) {
console.error(
`Error calculating turnaround time for event ${event.id}: ${e}`,
`Likely due to PR author ${event.payload.pull_request.user.login} being deleted`,
event,
);
}
appendEvent(event.payload.pull_request.user.login, {
type: "pr_merged",
title: `${event.repo.name}#${event.payload.pull_request.number}`,
Expand Down

0 comments on commit 492a1cd

Please sign in to comment.