Skip to content

Commit

Permalink
Include introduction only in new GitHub reviews (#27)
Browse files Browse the repository at this point in the history
We're expanding the introduction text in the PR body to include more
information, and it isn't helpful to include that information in
follow-up reviews. If there are any reviews on a PR from
'github-actions[bot]' already, assume it was us.
  • Loading branch information
cottsay authored Oct 8, 2024
1 parent 8b70b18 commit cd74be7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions rosdistro_reviewer/submitter/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
GITHUB_TOKEN_ENVIRONMENT_VARIABLE = EnvironmentVariable(
'GITHUB_TOKEN', 'Authentication token secret for GitHub')

BODY_HEADER = """Hi there, thanks for contributing to ROS!
INTRODUCTION = """Hi there, thanks for contributing to ROS!
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


Expand Down Expand Up @@ -91,7 +93,14 @@ def _annotation_to_comment(
message = review.summarize()
recommendation = review.recommendation

# Check if we've already posted a review for this PR
already_reviewed = any(
review.user.login == 'github-actions[bot]'
for review in pr.get_reviews())
if not already_reviewed:
message = INTRODUCTION + message

pr.create_review(
body=BODY_HEADER + message,
body=message,
event=RECOMMENDATION_EVENTS[recommendation],
comments=comments)
1 change: 1 addition & 0 deletions test/spell_check.words
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ lenny
libdelta
linter
linting
login
mantic
metafunc
mktemp
Expand Down

0 comments on commit cd74be7

Please sign in to comment.