diff --git a/lib/platform/github/storage.js b/lib/platform/github/storage.js index e4eb73dd9b1ef3d184ce95c32ef65c7c33a2b3a4..2d747db259748ed4b0eff1eaddd3e8d3e94da05b 100644 --- a/lib/platform/github/storage.js +++ b/lib/platform/github/storage.js @@ -40,8 +40,7 @@ class Storage { branchList = null; } - // Returns true if branch exists, otherwise false - async function branchExists(branchName) { + async function getBranchList() { if (!branchList) { logger.debug('Retrieving branchList'); branchList = (await get( @@ -52,7 +51,12 @@ class Storage { )).body.map(branch => branch.name); logger.debug({ branchList }, 'Retrieved branchList'); } - const res = branchList.includes(branchName); + return branchList; + } + + // Returns true if branch exists, otherwise false + async function branchExists(branchName) { + const res = (await getBranchList()).includes(branchName); logger.debug(`branchExists(${branchName})=${res}`); return res; }