Fixing by falling back to the committer and check to see if there's a user

Signed-off-by: Ben Lambert <blam@spotify.com>
This commit is contained in:
Ben Lambert
2022-01-20 13:19:17 +01:00
committed by Fredrik Adelöw
parent 1e423fab53
commit 6d08f818a6
+4 -11
View File
@@ -50,9 +50,9 @@ const getRepoEvents = async ({ github, context, pull_number }) => {
updated_at: submitted_at,
type: 'review',
})),
...commits.map(({ commit, author }) => ({
user: author,
updated_at: commit.author.date,
...commits.map(({ commit, author, committer }) => ({
user: author ?? committer,
updated_at: commit.author.date ?? commit.committer.date,
type: 'commit',
})),
...pullComments.map(({ user, updated_at }) => ({
@@ -69,14 +69,7 @@ const getRepoEvents = async ({ github, context, pull_number }) => {
return events
.sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at))
.filter(({ user, ...evt }) => {
if (!user) {
console.warn('no evt', evt);
return false
}
return !user.login.includes('[bot]');
});
.filter(({ user, ...evt }) => !user?.login.includes('[bot]') ?? false);
};
module.exports = async ({ github, context, core }) => {