also looking at this
fix(review): persist review state where it is read back
#1405
6 files
+176
-14
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | import type { ReviewFinding, ReviewResult } from './findings' |
| 2 | import type { ReviewState } from './marker' | |
| 2 | 3 | import { fingerprint } from './findings' |
| 3 | 4 | import { serializeReviewState } from './marker' |
| 4 | 5 | |
| @@ -25,6 +26,12 @@ export interface PreparedReview { | ||
| 25 | 26 | comments: InlineComment[] |
| 26 | 27 | /** `REQUEST_CHANGES` only when configured and warranted */ |
| 27 | 28 | event: 'COMMENT' | 'REQUEST_CHANGES' |
| 29 | /** | |
| 30 | * State this review established, for the caller to persist onto the pull | |
| 31 | * request. The copy inside `body` is an audit trail of what this particular | |
| 32 | * review saw; only the copy on `pr.body` is ever read back. | |
| 33 | */ | |
| 34 | state: Omit<ReviewState, 'schemaVersion'> | |
| 28 | 35 | } |
| 29 | 36 | |
| 30 | 37 | /** |
| @@ -83,6 +90,11 @@ export function prepareReview( | ||
| 83 | 90 | body: renderSummary(result, counts, options.headSha, fingerprints), |
| 84 | 91 | comments, |
| 85 | 92 | event: options.requestChangesOn === 'critical' && hasCritical ? 'REQUEST_CHANGES' : 'COMMENT', |
| 93 | state: { | |
| 94 | reviewedSha: options.headSha, | |
| 95 | fingerprints, | |
| 96 | reviewedAt: new Date().toISOString(), | |
| 97 | }, | |
| 86 | 98 | } |
| 87 | 99 | } |
| 88 | 100 | |