From e89ef0ddb86852e58ef3708d153fd9b9699dbb04 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@keylocation.sg> Date: Thu, 16 Nov 2017 14:15:18 +0100 Subject: [PATCH] chore: add debugging to findPr and getPrList --- lib/platform/github/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 2c76964f6d..ab8bfe9f24 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -482,7 +482,9 @@ async function ensureCommentRemoval(issueNo, topic) { // Pull Request async function getPrList() { + logger.debug('getPrList()'); if (!config.prList) { + logger.debug('Retrieving PR list'); const res = await get( `repos/${config.repoName}/pulls?per_page=100&state=all`, { paginate: true } @@ -501,12 +503,16 @@ async function getPrList() { async function findPr(branchName, prTitle, state = 'all') { logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`); const prList = await getPrList(); - return prList.find( + const pr = prList.find( p => p.branchName === branchName && (!prTitle || p.title === prTitle) && (state === 'all' || p.state === state) ); + if (pr) { + logger.debug(`Found PR #${pr.number}`); + } + return pr; } // Creates PR and returns PR number -- GitLab