diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 0feb77f36df5b8335edd5c2977d3d1e8949ef0e7..b23555415ca6a53f1ca0f58a328d0af61f19c0ba 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -328,18 +328,22 @@ 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.indexOf(`refs/heads/${branchPrefix}`) === 0) { - 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.indexOf(`refs/heads/${branchPrefix}`) === 0) { + arr.push(branch.ref.substring('refs/heads/'.length)); + } + return arr; + }, []); + } catch (err) /* istanbul ignore next */ { + return []; + } } async function isBranchStale(branchName) {