From b932829060f1dc803b68c00401df8c3d27a4d297 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 27 Jul 2018 19:26:18 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Revert=20"refactor(github):=20don?= =?UTF-8?q?=E2=80=99t=20try/catch=20getAllRenovateBranches"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ba12183626d5243799cecc6b95997dadf0cd0cbb. --- lib/platform/github/index.js | 52 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 1cdb58e30e..dc35221f37 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -404,30 +404,34 @@ async function branchExists(branchName) { async function getAllRenovateBranches(branchPrefix) { logger.trace('getAllRenovateBranches'); - const allBranches = (await get( - `repos/${config.repository}/git/refs/heads/${branchPrefix}`, - { - paginate: true, - } - )).body; - return allBranches.reduce((arr, branch) => { - if (branch.ref.startsWith(`refs/heads/${branchPrefix}`)) { - arr.push(branch.ref.substring('refs/heads/'.length)); - } - if ( - branchPrefix.endsWith('/') && - branch.ref === `refs/heads/${branchPrefix.slice(0, -1)}` - ) { - logger.warn( - `Pruning branch "${branchPrefix.slice( - 0, - -1 - )}" so that it does not block PRs` - ); - arr.push(branch.ref.substring('refs/heads/'.length)); - } - return arr; - }, []); + try { + const allBranches = (await get( + `repos/${config.repository}/git/refs/heads/${branchPrefix}`, + { + paginate: true, + } + )).body; + return allBranches.reduce((arr, branch) => { + if (branch.ref.startsWith(`refs/heads/${branchPrefix}`)) { + arr.push(branch.ref.substring('refs/heads/'.length)); + } + if ( + branchPrefix.endsWith('/') && + branch.ref === `refs/heads/${branchPrefix.slice(0, -1)}` + ) { + logger.warn( + `Pruning branch "${branchPrefix.slice( + 0, + -1 + )}" so that it does not block PRs` + ); + arr.push(branch.ref.substring('refs/heads/'.length)); + } + return arr; + }, []); + } catch (err) /* istanbul ignore next */ { + return []; + } } async function isBranchStale(branchName) { -- GitLab