diff --git a/lib/create-issue.js b/lib/create-issue.js index a21133b5..0571a8f3 100644 --- a/lib/create-issue.js +++ b/lib/create-issue.js @@ -1,7 +1,7 @@ module.exports = createIssue function createIssue (state) { - const {filename, patch, branchUrl} = state.commit + const {filename, patch, branchUrl, message} = state.commit const content = state.template .replace(/\$DIFF/, patch) .replace(/\$FILENAME/, filename) @@ -13,7 +13,7 @@ function createIssue (state) { return state.api.issues.create({ owner: state.owner, repo: state.issueRepo, - title: state.commit.message, + title: message.split('\n\n')[0], body: content, labels: state.labels }) diff --git a/test/unit/create-issue-test.js b/test/unit/create-issue-test.js index 299fb568..cf8a01ff 100644 --- a/test/unit/create-issue-test.js +++ b/test/unit/create-issue-test.js @@ -20,7 +20,7 @@ test('create issue request succeeds', t => { sha: 'sha', labels: 'label-1', commit: { - message: 'title', + message: 'title\n\ndescription', patch: 'patch', filename: 'filename', branchUrl: 'branchUrl' @@ -39,6 +39,7 @@ test('create issue request succeeds', t => { .then((response) => { const createIssueArgs = api.issues.create.lastCall.arg t.is(response.data.html_url, 'html_url') + t.is(createIssueArgs.title, 'title') t.is(createIssueArgs.body, 'test value1: patch value2: filename value3: branchUrl value4: installRepo') t.is(createIssueArgs.repo, 'issueRepo') t.is(createIssueArgs.labels, 'label-1')