From b184d3a217c664f215db079e2dba48542bcf6c99 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Fri, 2 Feb 2018 18:04:41 +0100
Subject: [PATCH] fix: handle 403 blocked from github

---
 lib/platform/github/index.js          | 3 +++
 test/workers/repository/error.spec.js | 1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js
index a689e01bf8..ea64c22fd6 100644
--- a/lib/platform/github/index.js
+++ b/lib/platform/github/index.js
@@ -123,6 +123,9 @@ async function initRepo({ repository, token, endpoint, forkMode, forkToken }) {
     if (err.statusCode === 404) {
       throw new Error('not-found');
     }
+    if (err.statusCode === 403 && err.message === 'Repository access blocked') {
+      throw new Error('blocked');
+    }
     logger.info({ err, res }, 'Unknown GitHub initRepo error');
     throw err;
   }
diff --git a/test/workers/repository/error.spec.js b/test/workers/repository/error.spec.js
index e651f3895c..09078ebb64 100644
--- a/test/workers/repository/error.spec.js
+++ b/test/workers/repository/error.spec.js
@@ -19,6 +19,7 @@ describe('workers/repository/error', () => {
       'config-validation',
       'registry-failure',
       'archived',
+      'blocked',
       'not-found',
     ];
     errors.forEach(err => {
-- 
GitLab