From 486b671196eca17989aff097992ba4a88a95e28e Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Wed, 22 Mar 2023 13:14:20 +0100 Subject: [PATCH] fix(github): handle non-existing commit user --- src/utils/github/getCommitAuthors.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/github/getCommitAuthors.ts b/src/utils/github/getCommitAuthors.ts index e349bbc..5e710d3 100644 --- a/src/utils/github/getCommitAuthors.ts +++ b/src/utils/github/getCommitAuthors.ts @@ -126,7 +126,13 @@ export async function getCommitAuthors( // Add each commit author in the pull request. for (const commit of data.repository.pullRequest.commits.nodes) { for (const author of commit.commit.authors.nodes) { - addAuthor(author.user.login) + /** + * @note In some situations, GitHub will return "user: null" + * for the commit user. Nobody to add to the authors then. + */ + if (author.user != null) { + addAuthor(author.user.login) + } } }