Skip to content

Commit 62a919d

Browse files
committed
chore: make Gemini-review update its summary comment
instead of creating a new one all the time. This addresses feedback shared by the team on this new workflow.
1 parent 4b73fa9 commit 62a919d

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

.github/workflows/code-review.yml

+27-3
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,33 @@ jobs:
221221
// Get the PR number from the event
222222
const prNumber = ${{ github.event.pull_request.number }};
223223
224-
github.rest.issues.createComment({
224+
// Search for existing comments from our bot
225+
const comments = await github.rest.issues.listComments({
225226
issue_number: prNumber,
226227
owner: context.repo.owner,
227228
repo: context.repo.repo,
228-
body: `## LLM Analysis of PR Changes\n\n${analysis}`
229-
})
229+
per_page: 100
230+
});
231+
232+
// Find our bot's comment by looking for the specific header
233+
const botComment = comments.data.find(comment =>
234+
comment.body.startsWith('## LLM Analysis of PR Changes')
235+
);
236+
237+
if (botComment) {
238+
// Update existing comment
239+
await github.rest.issues.updateComment({
240+
comment_id: botComment.id,
241+
owner: context.repo.owner,
242+
repo: context.repo.repo,
243+
body: `## LLM Analysis of PR Changes\n\n${analysis}`
244+
});
245+
} else {
246+
// Create new comment if none exists
247+
await github.rest.issues.createComment({
248+
issue_number: prNumber,
249+
owner: context.repo.owner,
250+
repo: context.repo.repo,
251+
body: `## LLM Analysis of PR Changes\n\n${analysis}`
252+
});
253+
}

0 commit comments

Comments
 (0)