From fe73751d69aef0430b14c1cb47034cf4e72d925a Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 16 May 2021 11:49:22 +0200
Subject: [PATCH] fix(github): handle PLATFORM_INTEGRATION_UNAUTHORIZED for
 branch protection

---
 lib/platform/github/index.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index ded0460d31..f80169ccd8 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -465,7 +465,10 @@ export async function getRepoForceRebase(): Promise<boolean> {
     } catch (err) {
       if (err.statusCode === 404) {
         logger.debug(`No branch protection found`);
-      } else if (err.statusCode === 403) {
+      } else if (
+        err.message === PLATFORM_INTEGRATION_UNAUTHORIZED ||
+        err.statusCode === 403
+      ) {
         logger.debug(
           'Branch protection: Do not have permissions to detect branch protection'
         );
-- 
GitLab