From e9bf2a26e15ee148286b0c1d7766937a03830f2b Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@keylocation.sg>
Date: Fri, 10 Nov 2017 13:00:18 +0100
Subject: [PATCH] fix: check commit message before ignoring web-flow commits
 (#1138)

---
 lib/platform/github/index.js       | 12 +++++++++++-
 test/platform/github/index.spec.js |  8 ++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index 288d57f096..068dc6fa0a 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -551,8 +551,18 @@ async function getPr(prNo) {
           logger.debug('Could not determine commit author');
         }
         logger.debug(`Commit author is: ${author}`);
+        const message = commit.commit ? commit.commit.message : '';
+        const parents = commit.parents || [];
+        let ignoreWebFlow = false;
+        if (
+          author === 'web-flow' &&
+          message.startsWith("Merge branch '") &&
+          parents.length === 2
+        ) {
+          ignoreWebFlow = true;
+        }
         // Ignore GitHub "web-flow"
-        if (author !== 'web-flow' && arr.indexOf(author) === -1) {
+        if (!ignoreWebFlow && arr.indexOf(author) === -1) {
           arr.push(author);
         }
         return arr;
diff --git a/test/platform/github/index.spec.js b/test/platform/github/index.spec.js
index c52bee229b..38e0c19c6c 100644
--- a/test/platform/github/index.spec.js
+++ b/test/platform/github/index.spec.js
@@ -1066,8 +1066,8 @@ describe('platform/github', () => {
       get.mockImplementationOnce(() => ({
         body: [
           {
-            author: {
-              login: 'foo',
+            committer: {
+              login: 'web-flow',
             },
           },
           {
@@ -1105,6 +1105,10 @@ describe('platform/github', () => {
             committer: {
               login: 'web-flow',
             },
+            commit: {
+              message: "Merge branch 'master' into renovate/foo",
+            },
+            parents: [1, 2],
           },
         ],
       }));
-- 
GitLab