From eec2072a24609e0472ccf621ef14a3e6277b0ce8 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Thu, 4 Oct 2018 11:22:31 +0200
Subject: [PATCH] fix: reorder master issue approval check

---
 lib/workers/branch/index.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index 6e7183733c..46cf035bba 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -39,15 +39,6 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) {
   if (masterIssueCheck) {
     logger.info('Branch has been checked in master issue: ' + masterIssueCheck);
   }
-  // istanbul ignore if
-  if (!branchExists && config.masterIssueApproval) {
-    if (masterIssueCheck) {
-      logger.info(`Branch ${config.branchName} is approved for creation`);
-    } else {
-      logger.info(`Branch ${config.branchName} needs approval`);
-      return 'needs-approval';
-    }
-  }
   try {
     logger.debug(
       `Branch has ${dependencies ? dependencies.length : 0} upgrade(s)`
@@ -94,6 +85,15 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) {
       }
       return 'already-existed';
     }
+    // istanbul ignore if
+    if (!branchExists && config.masterIssueApproval) {
+      if (masterIssueCheck) {
+        logger.info(`Branch ${config.branchName} is approved for creation`);
+      } else {
+        logger.info(`Branch ${config.branchName} needs approval`);
+        return 'needs-approval';
+      }
+    }
     if (!branchExists && prHourlyLimitReached && !masterIssueCheck) {
       logger.info('Reached PR creation limit - skipping branch creation');
       return 'pr-hourly-limit-reached';
-- 
GitLab