Skip to content

Commit

Permalink
fix: support commits with broken email (no user)
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-run committed May 14, 2024
1 parent c102dea commit 6721ccb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/actions/work/work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type CommitsInRangeNode = {
user: {
name: string
login: string
}
} | null
}
}[]
}
Expand Down Expand Up @@ -102,10 +102,10 @@ export async function displayCommitsForPeriod(
...commit,
type: classifyCommit(commit.commit),
})),
(it) => {
if (author == null) return it
(classifiedCommit) => {
if (author == null) return classifiedCommit

return R.filter(it, (it) => it.commit.author.user.login === author)
return R.filter(classifiedCommit, (commit) => commit.commit.author.user?.login === author)
},
R.groupBy((it) => it.type),
)
Expand Down Expand Up @@ -159,8 +159,8 @@ export async function displayCommitsForPeriod(

log(
` ${cleanMessage} in ${chalk.green(commit.repo)} (by ${
commit.commit.author.user.login
} ${authorToColorAvatar(commit.commit.author.user.login)})`,
commit.commit.author.user?.login ?? commit.commit.author.name
} ${authorToColorAvatar(commit.commit.author.user?.login ?? commit.commit.author.name)})`,
)
}
}
Expand All @@ -173,7 +173,7 @@ export async function displayCommitsForPeriod(

function classifyCommit(commit: {
message: string
author: { date: string; email: string; name: string; user: { name: string; login: string } }
author: { date: string; email: string; name: string; user: { name: string; login: string } | null }
}): string {
switch (true) {
case /^Merge pull request.*dependabot/g.test(commit.message):
Expand Down

0 comments on commit 6721ccb

Please sign in to comment.