From a5c47e082a095b998e4be7996779070deae34ff3 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 10 Dec 2017 15:58:00 +0100
Subject: [PATCH] refactor: consistency of branch protection logging

---
 lib/platform/github/index.js | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index 71f244144e..67a7bd4b3a 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -115,15 +115,21 @@ async function getRepoForceRebase() {
     try {
       config.repoForceRebase = false;
       const branchProtection = await getBranchProtection(config.baseBranch);
-      logger.info('Base branch protection found');
+      logger.info('Branch protection found');
       if (branchProtection.required_pull_request_reviews) {
-        logger.info('PR Reviews are required before merging');
+        logger.info(
+          'Branch protection: PR Reviews are required before merging'
+        );
         config.prReviewsRequired = true;
       }
       if (branchProtection.required_status_checks) {
-        logger.info('Status checks are required before merging');
+        logger.info(
+          'Branch protection: Status checks are required before merging'
+        );
         if (branchProtection.required_status_checks.strict) {
-          logger.info('PRs must be up-to-date before merging');
+          logger.info(
+            'Branch protection: PRs must be up-to-date before merging'
+          );
           config.repoForceRebase = true;
         }
       }
@@ -133,17 +139,17 @@ async function getRepoForceRebase() {
             users: branchProtection.restrictions.users,
             teams: branchProtection.restrictions.teams,
           },
-          'Pushing to branch is restricted'
+          'Branch protection: Pushing to branch is restricted'
         );
         config.pushProtection = true;
       }
     } catch (err) {
       if (err.statusCode === 404) {
-        logger.info(
-          `Repository has no branch protection for ${config.baseBranch}`
-        );
+        logger.info(`Branch protection: none found`);
       } else if (err.statusCode === 403) {
-        logger.debug('Do not have permissions to detect branch protection');
+        logger.warn(
+          'Branch protection: Do not have permissions to detect branch protection'
+        );
       } else {
         throw err;
       }
-- 
GitLab