Copilot commented on code in PR #13878:
URL: https://github.com/apache/cloudstack/pull/13878#discussion_r3783988687
##########
.github/workflows/sonar-check.yml:
##########
@@ -106,10 +108,26 @@ jobs:
`> [View full Actions run](${runUrl})`,
].filter(l => l !== undefined).join('\n');
- await github.rest.issues.createComment({
+ const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
- body: body,
});
- console.log('Posted coverage grade comment');
+ const existing = comments.find(c => c.user.type === 'Bot' &&
c.body.includes(marker));
Review Comment:
`issues.listComments` is paginated (default `per_page` is 30) and ordered
oldest-first by default, so `find(...)` may miss an existing marker comment
(leading to duplicates) and/or update the oldest marker comment instead of the
most recent one. Fetch comments in `direction: 'desc'` with a larger `per_page`
and iterate pages until a matching marker comment is found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]