From 56cb37871a872ddd06186ab8a4bb2d0d519cb4e3 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Tue, 1 Oct 2024 18:45:46 -0500 Subject: [PATCH 1/2] Include more information in the GitHub review body Also drop the automated review message from the text representation of the review. It's pretty obvious that it's automated in that context. --- rosdistro_reviewer/review.py | 8 +++++--- rosdistro_reviewer/submitter/github.py | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rosdistro_reviewer/review.py b/rosdistro_reviewer/review.py index 6842c59..4ff7f06 100644 --- a/rosdistro_reviewer/review.py +++ b/rosdistro_reviewer/review.py @@ -136,9 +136,11 @@ def summarize(self) -> str: if not self._elements: return '(No changes to supported elements were detected)' - message = 'This is an automated review.' - for element, criteria in self.elements.items(): - message += f'\n\nFor changes related to {element}:' + message = '' + for idx, (element, criteria) in enumerate(self.elements.items()): + if idx: + message += '\n\n' + message += f'For changes related to {element}:' for criterion in criteria: message += '\n* ' + criterion.recommendation.as_symbol() message += ' ' + textwrap.indent(criterion.rationale, ' ')[2:] diff --git a/rosdistro_reviewer/submitter/github.py b/rosdistro_reviewer/submitter/github.py index c2a2242..f674ebf 100644 --- a/rosdistro_reviewer/submitter/github.py +++ b/rosdistro_reviewer/submitter/github.py @@ -16,6 +16,12 @@ GITHUB_TOKEN_ENVIRONMENT_VARIABLE = EnvironmentVariable( 'GITHUB_TOKEN', 'Authentication token secret for GitHub') +BODY_HEADER = """Hi there, thanks for contributing to ROS! + +This is an automated review generated by the [`rosdistro-review` tool](https://github.com/ros-infrastructure/rosdistro-reviewer?tab=readme-ov-file#running-rosdistro-reviewer-in-github-actions). If you'd like the tool to run again, just re-request review from GitHub Actions. + +""" # noqa: E501 + class GitHubSubmitter(ReviewSubmitterExtensionPoint): """Submit reviews to GitHub pull requests.""" @@ -86,6 +92,6 @@ def _annotation_to_comment( recommendation = review.recommendation pr.create_review( - body=message, + body=BODY_HEADER + message, event=RECOMMENDATION_EVENTS[recommendation], comments=comments) From 0df37d7101a970200b38970bad6cf62606c1ff4f Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 3 Oct 2024 13:13:38 -0500 Subject: [PATCH 2/2] Minor tweaks to markdown links --- rosdistro_reviewer/submitter/github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosdistro_reviewer/submitter/github.py b/rosdistro_reviewer/submitter/github.py index f674ebf..0ca8c53 100644 --- a/rosdistro_reviewer/submitter/github.py +++ b/rosdistro_reviewer/submitter/github.py @@ -18,7 +18,7 @@ BODY_HEADER = """Hi there, thanks for contributing to ROS! -This is an automated review generated by the [`rosdistro-review` tool](https://github.com/ros-infrastructure/rosdistro-reviewer?tab=readme-ov-file#running-rosdistro-reviewer-in-github-actions). If you'd like the tool to run again, just re-request review from GitHub Actions. +This is an automated review generated by the [rosdistro-reviewer tool](https://github.com/ros-infrastructure/rosdistro-reviewer). If you'd like the tool to run again, just [re-request review from GitHub Actions](https://github.com/ros-infrastructure/rosdistro-reviewer?tab=readme-ov-file#running-rosdistro-reviewer-in-github-actions). """ # noqa: E501