From 6d08f818a6172f90bb4932bde7d76d5842a99685 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:19:17 +0100 Subject: [PATCH] Fixing by falling back to the committer and check to see if there's a user Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index 7178330e5c..b706eba7fb 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -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 }) => {