From 7c2e432fafa97fa47df3341dfac1d680110be765 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Wed, 2 Sep 2020 11:19:11 +0900 Subject: [PATCH] (fix) handle case when pull request body is null --- dist/index.js | 4 +++- src/main.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 70bd00ddc..9b604f939 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1560,7 +1560,9 @@ function run() { if (isPullRequest) { const pullRequest = yield githubHelper.getPull(github.context.repo, github.context.payload.issue.number); // Truncate the body to keep the size of the payload under the max - pullRequest.body = pullRequest.body.slice(0, 1000); + if (pullRequest.body) { + pullRequest.body = pullRequest.body.slice(0, 1000); + } clientPayload['pull_request'] = pullRequest; } // Dispatch for each matching configuration diff --git a/src/main.ts b/src/main.ts index 313c6d4ce..d8dc6a918 100644 --- a/src/main.ts +++ b/src/main.ts @@ -164,7 +164,9 @@ async function run(): Promise { github.context.payload.issue.number ) // Truncate the body to keep the size of the payload under the max - pullRequest.body = pullRequest.body.slice(0, 1000) + if (pullRequest.body) { + pullRequest.body = pullRequest.body.slice(0, 1000) + } clientPayload['pull_request'] = pullRequest }