From da8cdbfb06cebb2270619d45d76cc7fa3b5843e7 Mon Sep 17 00:00:00 2001 From: Ryan Garant Date: Sun, 29 Sep 2019 20:39:42 -0700 Subject: [PATCH] fix(pull-request): only add body when updating PR when body is truthy Resolves bug report #678: Error: Error closing PR Error: Can't close pull request 1319. HttpError: 'body' cannot be null at main (/usr/lib/node_modules/gh/lib/cmds/pull-request.js:164:23) at processTicksAndRejections (internal/process/task_queues.js:85:5) --- .vscode/launch.json | 12 +----------- src/cmds/pull-request.ts | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index af8f25a8..3c8383e6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,17 +9,7 @@ "type": "node", "request": "launch", "runtimeArgs": ["-r", "ts-node/register"], - "args": [ - "${workspaceFolder}/src/debug.ts", - "is", - "--new", - "--title", - "Add Ramda as a npm dependency to being refactoring towards functional style", - "--message", - "Ramda is the top functional programming lib for JS", - "--repo", - "node-gh" - ], + "args": ["${workspaceFolder}/src/debug.ts", "pr", "109", "-C"], // "args": ["${workspaceFolder}/src/debug.ts", "ji", "LWM-117", "--status"], "console": "integratedTerminal" }, diff --git a/src/cmds/pull-request.ts b/src/cmds/pull-request.ts index 165e9c37..cae006c3 100755 --- a/src/cmds/pull-request.ts +++ b/src/cmds/pull-request.ts @@ -858,10 +858,10 @@ function updatePullRequest_(options, title, opt_body, state) { const payload = { state, title, - body: opt_body, pull_number: options.number, repo: options.repo, owner: options.user, + ...(opt_body ? { body: opt_body } : {}), } return options.GitHub.pulls.update(payload)