Skip to content

Commit

Permalink
fix: exclude commit description from issue title
Browse files Browse the repository at this point in the history
Fixes #152
  • Loading branch information
synicalsyntax authored and gr2m committed Feb 28, 2018
1 parent 8d327ba commit a4004bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/create-issue.js
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
})
Expand Down
3 changes: 2 additions & 1 deletion test/unit/create-issue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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')
Expand Down

0 comments on commit a4004bc

Please sign in to comment.