diff --git a/lib/workers/repository/master-issue.js b/lib/workers/repository/master-issue.js index 205088991f05a667df25217d476369233214ed69..8e9839d7d7419eb38e89622f472b8e5916bf803d 100644 --- a/lib/workers/repository/master-issue.js +++ b/lib/workers/repository/master-issue.js @@ -3,11 +3,11 @@ module.exports = { }; // istanbul ignore next -function getListItem(branch, type) { +function getListItem(branch, type, pr) { let item = ' - [ ] '; item += `<!-- ${type}-branch=${branch.branchName} -->`; - if (branch.prNo) { - item += `[${branch.prTitle}](../pull/${branch.prNo})`; + if (pr) { + item += `[${branch.prTitle}](../pull/${pr.number})`; } else { item += branch.prTitle; } @@ -115,10 +115,7 @@ async function ensureMasterIssue(config, branches) { 'These updates have all been created already. Click a checkbox below to force a retry/rebase of any.\n\n'; for (const branch of inProgress) { const pr = await platform.getBranchPr(branch.branchName); - if (pr) { - branch.prNo = pr.number; - } - issueBody += getListItem(branch, 'rebase'); + issueBody += getListItem(branch, 'rebase', pr); } issueBody += '\n'; } @@ -130,7 +127,12 @@ async function ensureMasterIssue(config, branches) { issueBody += 'These updates were closed unmerged and will not be recreated unless you click a checkbox below.\n\n'; for (const branch of alreadyExisted) { - issueBody += getListItem(branch, 'recreate'); + const pr = await platform.findPr( + branch.branchName, + branch.prTitle, + '!open' + ); + issueBody += getListItem(branch, 'recreate', pr); } issueBody += '\n'; }