Skip to content

Commit 7dd4ee1

Browse files
authored
Merge pull request #77 from peter-evans/dev
(fix) handle case when pull request body is null
2 parents 762c957 + 7c2e432 commit 7dd4ee1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dist/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,9 @@ function run() {
15601560
if (isPullRequest) {
15611561
const pullRequest = yield githubHelper.getPull(github.context.repo, github.context.payload.issue.number);
15621562
// Truncate the body to keep the size of the payload under the max
1563-
pullRequest.body = pullRequest.body.slice(0, 1000);
1563+
if (pullRequest.body) {
1564+
pullRequest.body = pullRequest.body.slice(0, 1000);
1565+
}
15641566
clientPayload['pull_request'] = pullRequest;
15651567
}
15661568
// Dispatch for each matching configuration

src/main.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ async function run(): Promise<void> {
164164
github.context.payload.issue.number
165165
)
166166
// Truncate the body to keep the size of the payload under the max
167-
pullRequest.body = pullRequest.body.slice(0, 1000)
167+
if (pullRequest.body) {
168+
pullRequest.body = pullRequest.body.slice(0, 1000)
169+
}
168170
clientPayload['pull_request'] = pullRequest
169171
}
170172

0 commit comments

Comments
 (0)