From f351480f1820cd174b750ac096a5ca18e77fc6ee Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 18 Dec 2017 10:29:46 +0100 Subject: [PATCH] fix: create issue in parent repo when in forkMode --- lib/platform/github/index.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index dc60e1b97d..5e0a6c4072 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -428,7 +428,8 @@ async function getBranchLastCommitTime(branchName) { async function getIssueList() { if (!config.issueList) { config.issueList = (await get( - `repos/${config.repoName}/issues?filter=created&state=open` + `repos/${config.parentRepo || + config.repoName}/issues?filter=created&state=open` )).body.map(i => ({ number: i.number, title: i.title, @@ -443,17 +444,20 @@ async function ensureIssue(title, body) { const issue = issueList.find(i => i.title === title); if (issue) { const issueBody = (await get( - `repos/${config.repoName}/issues/${issue.number}` + `repos/${config.parentRepo || config.repoName}/issues/${issue.number}` )).body.body; if (issueBody !== body) { logger.debug('Updating issue body'); - await get.patch(`repos/${config.repoName}/issues/${issue.number}`, { - body: { body }, - }); + await get.patch( + `repos/${config.parentRepo || config.repoName}/issues/${issue.number}`, + { + body: { body }, + } + ); return 'updated'; } } else { - await get.post(`repos/${config.repoName}/issues`, { + await get.post(`repos/${config.parentRepo || config.repoName}/issues`, { body: { title, body, @@ -469,9 +473,12 @@ async function ensureIssueClosing(title) { const issueList = await getIssueList(); for (const issue of issueList) { if (issue.title === title) { - await get.patch(`repos/${config.repoName}/issues/${issue.id}`, { - body: { state: 'closed' }, - }); + await get.patch( + `repos/${config.parentRepo || config.repoName}/issues/${issue.id}`, + { + body: { state: 'closed' }, + } + ); } } } -- GitLab