Skip to content

Commit 66d729b

Browse files
committed
fix: wrong comment api
1 parent 7979845 commit 66d729b

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

comment.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ def send_comment(token: str, repo_id: str, issue_number: int, content: str):
2222
pr.create_issue_comment(content)
2323

2424

25-
def send_code_comments(token: str, repo_id: str, issue_number: int, lines: typing.List[LineStat]):
25+
def send_code_comments(token: str, commit_id: str, repo_id: str, issue_number: int, lines: typing.List[LineStat]):
2626
g = Github(token)
2727
repo = g.get_repo(repo_id)
2828
pr = repo.get_pull(issue_number)
2929

30-
commit = pr.get_commits()[0]
30+
target = repo.get_commit(commit_id)
31+
logger.info(f"target commit: {target}")
3132
for each_line in lines:
3233
if each_line.refScope.crossFileRefCount > 0:
33-
logger.info(f"leave comment in {each_line.fileName} #{each_line.lineNumber}")
34-
pr.create_comment(
34+
logger.info(f"leave comment in {each_line.fileName} L{each_line.lineNumber}")
35+
pr.create_review_comment(
3536
f"[diffctx] cross file reference: {each_line.refScope.crossFileRefCount}",
36-
commit,
37+
target,
3738
each_line.fileName,
3839
each_line.lineNumber,
3940
)

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def main():
166166

167167
# code comments
168168
lines = parse_file_as(typing.List[LineStat], pathlib.Path(json_result_file))
169-
send_code_comments(repo_token, repo_name, int(issue_number), lines)
169+
send_code_comments(repo_token, after_sha, repo_name, int(issue_number), lines)
170170

171171

172172
if __name__ == "__main__":

0 commit comments

Comments
 (0)