diff --git a/post/clang_tidy_review/clang_tidy_review/__init__.py b/post/clang_tidy_review/clang_tidy_review/__init__.py index 4f1a616..4b9749a 100644 --- a/post/clang_tidy_review/clang_tidy_review/__init__.py +++ b/post/clang_tidy_review/clang_tidy_review/__init__.py @@ -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 = { @@ -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: diff --git a/post/clang_tidy_review/clang_tidy_review/post.py b/post/clang_tidy_review/clang_tidy_review/post.py index cc671a5..79e0e96 100755 --- a/post/clang_tidy_review/clang_tidy_review/post.py +++ b/post/clang_tidy_review/clang_tidy_review/post.py @@ -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" ) @@ -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())