Skip to content

Commit

Permalink
Merge pull request #77 from peter-evans/dev
Browse files Browse the repository at this point in the history
(fix) handle case when pull request body is null
  • Loading branch information
peter-evans authored Sep 2, 2020
2 parents 762c957 + 7c2e432 commit 7dd4ee1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 7dd4ee1

Please sign in to comment.