From 3378488c3f0d64ad06ea43701364deef8f1510bb Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 17 Jul 2019 09:44:37 +0200
Subject: [PATCH] fix(github): handle 422 responses

---
 lib/platform/github/gh-got-wrapper.ts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/platform/github/gh-got-wrapper.ts b/lib/platform/github/gh-got-wrapper.ts
index c13adbe49b..e99fc5b14e 100644
--- a/lib/platform/github/gh-got-wrapper.ts
+++ b/lib/platform/github/gh-got-wrapper.ts
@@ -146,6 +146,15 @@ async function get(
         throw new Error('platform-failure');
       }
       throw new Error('bad-credentials');
+    } else if (err.statusCode === 422) {
+      if (
+        err.body &&
+        err.body.errors &&
+        err.body.errors.find((e: any) => e.code === 'invalid')
+      ) {
+        throw new Error('repository-changed');
+      }
+      throw new Error('platform-failure');
     }
     throw err;
   }
-- 
GitLab