(fix) handle case when pull request body is null

This commit is contained in:
Peter Evans
2020-09-02 11:19:11 +09:00
parent 762c957c6d
commit 7c2e432faf
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -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
+3 -1
View File
@@ -164,7 +164,9 @@ async function run(): Promise<void> {
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
}