Skip to content

Commit 63be53c

Browse files
authored
chore: returns issue comment (#607)
# Motivation <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [x] I have added tests for my changes - [x] I have updated the documentation or added new documentation as needed --------- Co-authored-by: kopekC <[email protected]>
1 parent e2f06ce commit 63be53c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/codegen/git/clients/git_repo_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from github.Commit import Commit
99
from github.GithubException import GithubException, UnknownObjectException
1010
from github.GithubObject import NotSet, Opt
11+
from github.IssueComment import IssueComment
1112
from github.Label import Label
1213
from github.PullRequest import PullRequest
1314
from github.Repository import Repository
@@ -126,10 +127,10 @@ def create_issue_comment(
126127
self,
127128
pull: PullRequest,
128129
body: str,
129-
) -> None:
130+
) -> IssueComment:
130131
# TODO: add protections (ex: can write to PR)
131132
writeable_pr = self.repo.get_pull(pull.number)
132-
writeable_pr.create_issue_comment(body=body)
133+
return writeable_pr.create_issue_comment(body=body)
133134

134135
####################################################################################################################
135136
# PULL REQUESTS

src/codegen/git/repo_operator/repo_operator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from git import Diff, GitCommandError, InvalidGitRepositoryError, Remote
1515
from git import Repo as GitCLI
1616
from git.remote import PushInfoList
17+
from github.IssueComment import IssueComment
1718
from github.PullRequest import PullRequest
1819

1920
from codegen.configs.models.secrets import DefaultSecrets
@@ -717,7 +718,7 @@ def get_pr_data(self, pr_number: int) -> dict:
717718
"""Returns the data associated with a PR"""
718719
return self.remote_git_repo.get_pr_data(pr_number)
719720

720-
def create_pr_comment(self, pr_number: int, body: str) -> None:
721+
def create_pr_comment(self, pr_number: int, body: str) -> IssueComment:
721722
"""Create a general comment on a pull request.
722723
723724
Args:
@@ -726,7 +727,8 @@ def create_pr_comment(self, pr_number: int, body: str) -> None:
726727
"""
727728
pr = self.remote_git_repo.get_pull_safe(pr_number)
728729
if pr:
729-
self.remote_git_repo.create_issue_comment(pr, body)
730+
comment = self.remote_git_repo.create_issue_comment(pr, body)
731+
return comment
730732

731733
def create_pr_review_comment(
732734
self,

0 commit comments

Comments
 (0)