Skip to content

Commit

Permalink
Split workflow: return the number of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bwrsandman committed Jan 11, 2024
1 parent df2e121 commit a09d6ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion post/clang_tidy_review/clang_tidy_review/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def convert_comment_to_annotations(comment):
}


def post_annotations(pull_request: PullRequest, review: Optional[PRReview]):
def post_annotations(pull_request: PullRequest, review: Optional[PRReview]) -> int:
"""Post the first 10 comments in the review as annotations"""

body = {
Expand Down Expand Up @@ -1041,6 +1041,7 @@ def post_annotations(pull_request: PullRequest, review: Optional[PRReview]):
}

pull_request.post_annotations(body)
return total_comments


def bool_argument(user_input) -> bool:
Expand Down
8 changes: 4 additions & 4 deletions post/clang_tidy_review/clang_tidy_review/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)


def main():
def main() -> int:
parser = argparse.ArgumentParser(
description="Post a review based on feedback generated by the clang-tidy-review action"
)
Expand Down Expand Up @@ -79,13 +79,13 @@ def main():
)

if args.annotations:
post_annotations(pull_request, review)
return post_annotations(pull_request, review)
else:
lgtm_comment_body = strip_enclosing_quotes(args.lgtm_comment_body)
post_review(
return post_review(
pull_request, review, args.max_comments, lgtm_comment_body, args.dry_run
)


if __name__ == "__main__":
main()
exit(main())

0 comments on commit a09d6ab

Please sign in to comment.