Skip to content

Commit 0d7ac2b

Browse files
authored
Update gemini_review.py
1 parent 69718eb commit 0d7ac2b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hack/gemini_review.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def post_github_review_comments(repo_name, pr_number, diff_file, review_comment,
6060
if not commits:
6161
print(f"WARNING: No commits found for PR {pr_number}. Posting general issue comment for {diff_file.filename}.")
6262
pr.create_issue_comment(f"Review for {diff_file.filename}:\n{review_comment}")
63-
return # Exit the function
63+
return
6464

6565
latest_commit = commits[-1]
6666

@@ -72,19 +72,18 @@ def post_github_review_comments(repo_name, pr_number, diff_file, review_comment,
7272
line_num = int(line.lower().split("line")[1].split(":")[0].strip())
7373
lines_to_comment.append(line_num)
7474
except ValueError:
75-
continue # Skip lines that don't have a valid line number
75+
continue
7676

7777
if lines_to_comment:
7878
for line_num in lines_to_comment:
7979
try:
80-
pr.create_review_comment(body=review_comment, commit=latest_commit, path=diff_file.filename, position=line_num)
80+
pr.create_review_comment(body=review_comment, commit=latest_commit, path=diff_file.filename, line=line_num, side="RIGHT")
8181
except Exception as e:
8282
print(f"ERROR: Failed to create review comment for line {line_num} in {diff_file.filename}: {e}")
8383
print(f"Review comments for {diff_file.filename} posted successfully.")
8484
else:
8585
pr.create_issue_comment(f"Review for {diff_file.filename}:\n{review_comment}")
8686
print(f"Review for {diff_file.filename} posted as general comment since no line number was found.")
87-
8887
else:
8988
print(f"Gemini API returned no response for {diff_file.filename}.")
9089

0 commit comments

Comments
 (0)