(call: GhCall, action: Action, expected?: Record<string, unknown>)
| 52 | /** Returns when a status read showed the exact scripted review, either as JSON or, for rendered output such as |
| 53 | * `gh pr view --comments`, as the review's body text. Each scripted review has a distinct body. */ |
| 54 | export function reviewReadAt(call: GhCall, action: Action, expected?: Record<string, unknown>): number | undefined { |
| 55 | if ((action.kind !== "review" && action.kind !== "approval") || action.reviewId === undefined) return; |
| 56 | for (const output of jsonOutput(call)) { |
| 57 | if (containsReview(output.value, action.reviewId, expected)) return output.at; |
| 58 | } |
| 59 | const body = typeof expected?.body === "string" ? words(expected.body) : ""; |
| 60 | if (!body) return; |
| 61 | let text = ""; |
| 62 | for (const chunk of call.output) { |
| 63 | if (chunk.stream !== "stdout") continue; |
| 64 | text += chunk.text; |
| 65 | if (words(text).includes(body)) return chunk.at; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | const eventTypes = { |
| 70 | review: "com.github.pull_request.review.submitted.v1", |
no test coverage detected