Skip to content

Commit 724cbb1

Browse files
committed
Fix pull request review comment support
1 parent 2ef6421 commit 724cbb1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

command_handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def handle_comment(self, comment: Dict):
6060
commands = self.parse_commands_from_text(comment["comment"]["body"])
6161

6262
# Retrieve the issue this comment is attached to
63-
self.proposal = self.repo.get_issue(comment["issue"]["number"])
64-
self.proposal_labels_str = [label["name"] for label in comment["issue"]["labels"]]
63+
# Account for issue and pull request review comments
64+
issue = comment["issue"] if "issue" in comment else comment["pull_request"]
65+
self.proposal = self.repo.get_issue(issue["number"])
66+
self.proposal_labels_str = [label["name"] for label in issue["labels"]]
6567
original_labels = self.proposal_labels_str.copy()
6668

6769
self.comment = comment

webhook.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ def _process_comment(self, comment: Dict):
7676
log.debug("Ignoring comment from ourselves")
7777
return
7878

79-
# Is this a proposal?
80-
if not self._issue_has_label(comment["issue"], self.config.github_proposal_label):
79+
# Account for issue and pull request review comments
80+
issue = comment["issue"] if "issue" in comment else comment["pull_request"]
81+
82+
# Check if this is a proposal
83+
if not self._issue_has_label(issue, self.config.github_proposal_label):
8184
log.debug("Ignoring comment without appropriate proposal label")
8285
return
8386

0 commit comments

Comments
 (0)