File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ export default async function subtleSubmitReview ({
49
49
name : repo ,
50
50
prnumber : prnum
51
51
}
52
- const msg = ( await github . graphql ( query , variables ) ) . repository . pullRequest
52
+ const msgPre = ( await github . graphql ( query , variables ) ) . repository . pullRequest
53
53
54
54
// debounce if the PR description contains a watermark and the debounce time is not expired yet
55
- if ( msg . body . includes ( watermark ) && ! isOlderThanXHours ( msg . updatedAt , debounceTime ) ) {
55
+ if ( msgPre . body . includes ( watermark ) && ! isOlderThanXHours ( msgPre . updatedAt , debounceTime ) ) {
56
56
throw new Error ( 'debounce' )
57
57
}
58
58
@@ -65,6 +65,8 @@ export default async function subtleSubmitReview ({
65
65
66
66
const newExplaination = '<details><summary>AI Review</summary>' + '\n\n' + watermark + '\n\n' + await explainPatch ( ) + '</details>'
67
67
68
+ // fetch the message twice, to decrease the chances of race condition, but still debounce
69
+ const msg = ( await github . graphql ( query , variables ) ) . repository . pullRequest
68
70
const newBody = msg . body . match ( re )
69
71
? msg . body . replace ( re , newExplaination )
70
72
: msg . body + '\n\n' + newExplaination
You can’t perform that action at this time.
0 commit comments