From cbe5de157ea7b38a4e4cc53ca3aa53926c62cb5a Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 31 Oct 2023 13:40:27 +1300 Subject: [PATCH] fix: slice logging count not fairly representing the actual annotation collection slices --- dist/index.mjs | 6 ++++-- src/tasks/check.ts | 4 +++- src/tasks/comment.ts | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/index.mjs b/dist/index.mjs index 1d4eaa7..efcba60 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -22033,7 +22033,9 @@ async function updateCheckAnnotations(checkId, minimalAnnotations) { core3.debug(`[updateCheckAnnotations]: Begin pushing annotations (${minimalAnnotations.length})`); let i = 0; while (i < minimalAnnotations.length) { - core3.debug(`[updateCheckAnnotations]: Slicing ${i}...${i + CHECK_ANNOTATIONS_UPDATE_LIMIT}`); + core3.debug( + `[updateCheckAnnotations]: Slicing ${i}...${i + (CHECK_ANNOTATIONS_UPDATE_LIMIT - 1)}` + ); const slice = minimalAnnotations.slice(i, i + CHECK_ANNOTATIONS_UPDATE_LIMIT).map((minimalAnnotation) => { const annotation = { ...minimalAnnotation, @@ -22128,7 +22130,7 @@ function prepareComments(cfgCommentId, reportSections) { async function createOrUpdateComments(pullRequestNumber, commentsToPost, existingCommentIds) { let existingIdsIndex = 0; for (const comment of commentsToPost) { - if (existingCommentIds && existingCommentIds[existingIdsIndex] !== void 0) { + if (existingCommentIds?.[existingIdsIndex] !== void 0) { const commentId = existingCommentIds[existingIdsIndex]; await updateComment(commentId, comment); core5.debug(`[createOrUpdateComments]: updated comment (${commentId})`); diff --git a/src/tasks/check.ts b/src/tasks/check.ts index 6896b3c..a53c101 100644 --- a/src/tasks/check.ts +++ b/src/tasks/check.ts @@ -24,7 +24,9 @@ export async function updateCheckAnnotations( let i = 0; while (i < minimalAnnotations.length) { - core.debug(`[updateCheckAnnotations]: Slicing ${i}...${i + CHECK_ANNOTATIONS_UPDATE_LIMIT}`); + core.debug( + `[updateCheckAnnotations]: Slicing ${i}...${i + (CHECK_ANNOTATIONS_UPDATE_LIMIT - 1)}`, + ); const slice = minimalAnnotations .slice(i, i + CHECK_ANNOTATIONS_UPDATE_LIMIT) diff --git a/src/tasks/comment.ts b/src/tasks/comment.ts index 9b77fbd..6c3ce3d 100644 --- a/src/tasks/comment.ts +++ b/src/tasks/comment.ts @@ -90,7 +90,7 @@ async function createOrUpdateComments( ): Promise { let existingIdsIndex = 0; for (const comment of commentsToPost) { - if (existingCommentIds && existingCommentIds[existingIdsIndex] !== undefined) { + if (existingCommentIds?.[existingIdsIndex] !== undefined) { const commentId = existingCommentIds[existingIdsIndex]!; await updateComment(commentId, comment); core.debug(`[createOrUpdateComments]: updated comment (${commentId})`);