From 421adcfedc8ea0fea1a46c92a394ef37e75bd86c Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 10 Jan 2018 12:32:08 +0100
Subject: [PATCH] fix: use author first and then committer when checking pr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Lets author take precedence over committer, in case users edit PRs and commit Renovate’s commit back themselves.

Fixes #1364
---
 lib/platform/github/index.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index 9471952ce2..7b0d6f0704 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -707,12 +707,12 @@ async function getPr(prNo) {
       const authors = prCommits.reduce((arr, commit) => {
         logger.trace({ commit }, `Checking commit`);
         let author = 'unknown';
-        if (commit.committer && commit.committer.login) {
-          author = commit.committer.login;
-        } else if (commit.author) {
-          author = commit.author.login;
+        if (commit.author) {
+          author = commit.author.login || commit.author.email;
+        } else if (commit.committer && commit.committer.login) {
+          author = commit.committer.login || commit.committer.email;
         } else if (commit.commit && commit.commit.author) {
-          author = commit.commit.author.email;
+          author = commit.commit.author.login || commit.commit.author.email;
         } else {
           logger.debug('Could not determine commit author');
         }
-- 
GitLab