Skip to content

Commit 6e2286a

Browse files
committed
Do not throw error on empty approved review
1 parent 3d0e287 commit 6e2286a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ function pathListToMarkdown(files) {
122122
}
123123

124124
function getPayloadBody() {
125-
const body = context.payload.comment ? context.payload.comment.body : context.payload.review.body
125+
let body = context.payload.comment ? context.payload.comment.body : context.payload.review.body
126+
/**
127+
* Of the three ways to review code ("commented", "approved", "changes_requested"), only
128+
* "approved" can have a "null" body. For that case, ignore instead of throw error.
129+
*/
130+
if (context.payload?.review?.state === 'approved' && body === null) {
131+
body = ''
132+
}
126133
if (body == null) {
127134
throw new Error(`No body found, ${JSON.stringify(context)}`)
128135
}

0 commit comments

Comments
 (0)