Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
fix(pull-request): only add body to fwd payload when it exists
Browse files Browse the repository at this point in the history
    GitHub api expects you to not pass a body param if it is null or empty

    fix #709
  • Loading branch information
Ryan Garant committed Nov 3, 2019
1 parent 4b30f6a commit 0401863
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmds/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,22 +830,22 @@ async function submit(options, user) {
git.push(options.config.default_remote, pullBranch)

var payload: any = {
mediaType: {
previews: ['shadow-cat'],
},
owner: user,
base: options.branch,
head: `${options.user}:${pullBranch}`,
repo: options.repo,
mediaType: {
previews: ['shadow-cat'],
},
...(options.draft ? { draft: options.draft } : {}),
...(options.description ? { body: options.description } : {}),
}

try {
if (options.issue) {
payload.issue = options.issue
var { data } = await options.GitHub.pulls.createFromIssue(payload)
} else {
payload.body = options.description
payload.title = options.title || git.getLastCommitMessage(pullBranch)

var { data } = await options.GitHub.pulls.create(payload)
Expand Down

0 comments on commit 0401863

Please sign in to comment.