From 9572eaa6f97749f897bf7a435e2461369c0b5c03 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 4 Sep 2018 06:40:47 +0200
Subject: [PATCH] refactor(github): getBranchList

---
 lib/platform/github/storage.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/platform/github/storage.js b/lib/platform/github/storage.js
index e4eb73dd9b..2d747db259 100644
--- a/lib/platform/github/storage.js
+++ b/lib/platform/github/storage.js
@@ -40,8 +40,7 @@ class Storage {
       branchList = null;
     }
 
-    // Returns true if branch exists, otherwise false
-    async function branchExists(branchName) {
+    async function getBranchList() {
       if (!branchList) {
         logger.debug('Retrieving branchList');
         branchList = (await get(
@@ -52,7 +51,12 @@ class Storage {
         )).body.map(branch => branch.name);
         logger.debug({ branchList }, 'Retrieved branchList');
       }
-      const res = branchList.includes(branchName);
+      return branchList;
+    }
+
+    // Returns true if branch exists, otherwise false
+    async function branchExists(branchName) {
+      const res = (await getBranchList()).includes(branchName);
       logger.debug(`branchExists(${branchName})=${res}`);
       return res;
     }
-- 
GitLab