You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d593882
Browse filesBrowse the repository at this point in the historyBrowse files
Post inline audit comments in batches and never skip the summary
A large review can get a 502 from GitHub after the review was created,
which stopped the job before the summary comment. Post in batches of 20,
log a failed batch as a warning, and always continue to the summary.
// Post inline comments in small batches. Large reviews can make GitHub
180
+
// return a 502 after it has already created the review, so a failure here
181
+
// must never prevent the summary comment below. The next run dedupes by
182
+
// finding id, so a batch that half-succeeded is not repeated.
183
+
constBATCH=20;
184
+
letpostedCount=0;
185
+
for(leti=0;i<comments.length;i+=BATCH){
186
+
constbatch=comments.slice(i,i+BATCH);
187
+
try{
188
+
awaitgithub.rest.pulls.createReview({
189
+
...context.repo,
190
+
pull_number: prNumber,
191
+
commit_id: headSha,
192
+
event: "COMMENT",
193
+
body: i===0 ? `Example audit: ${comments.length} inline comment(s). The summary comment on this PR has the full list.` : `Example audit, continued (${i+1} to ${i+batch.length} of ${comments.length}).`,
194
+
comments: batch
195
+
});
196
+
postedCount+=batch.length;
197
+
}catch(err){
198
+
core.warning(`Inline review batch failed (${err.status??""}${err.message}); continuing with the summary comment.`);
body=body.replace("<!-- hub-audit -->\n","<!-- hub-audit -->\n> The **Audit examples** check failed because of the items under *Fix before merge*. Push a fix and it re-runs automatically.\n\n");
0 commit comments