From 9675bd6d0dadbce6f1179780f7bd8dddfb607162 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 11 Sep 2018 15:31:59 +0200
Subject: [PATCH] fix(github): graphql parsing

---
 lib/platform/github/gh-got-wrapper.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/platform/github/gh-got-wrapper.js b/lib/platform/github/gh-got-wrapper.js
index 3d09a0ccdf..eff3ca50d9 100644
--- a/lib/platform/github/gh-got-wrapper.js
+++ b/lib/platform/github/gh-got-wrapper.js
@@ -80,13 +80,15 @@ async function get(path, options, retries = 5) {
     }
     // istanbul ignore if
     if (method === 'POST' && path === 'graphql') {
-      if (res.errors && retries > 0) {
+      const goodResult = '{"data":{';
+      if (res.body.startsWith(goodResult)) {
+        if (retries === 0) {
+          logger.info('Recovered graphql query');
+        }
+      } else if (retries > 0) {
         logger.info('Retrying graphql query');
         return get(path, opts, 0);
       }
-      if (res.data && retries === 0) {
-        logger.info('Recovered graphql query');
-      }
     }
     return res;
   } catch (err) {
-- 
GitLab