From c9c79f2d9b5b0d55497ca2366b1d4cf9f1630281 Mon Sep 17 00:00:00 2001 From: Oleg Derevenetz Date: Thu, 22 Jul 2021 17:58:38 +0300 Subject: [PATCH] Pull request id is always a number, so parse appropriate command-line argument as int to impose additional sanity checking --- run_action.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/run_action.py b/run_action.py index 5085043..bff4247 100755 --- a/run_action.py +++ b/run_action.py @@ -31,7 +31,10 @@ def main(): help="The path to the clang-tidy fixes YAML", ) parser.add_argument( - "--pull-request-id", type=str, required=True, help="The pull request ID" + "--pull-request-id", + type=int, + required=True, + help="The pull request ID", ) parser.add_argument( "--repository-root", @@ -53,7 +56,7 @@ def main(): pull_request_files = [] # Request a maximum of 100 pages (3000 files) for page_num in range(1, 101): - pull_files_url = "%s/repos/%s/pulls/%s/files?page=%d" % ( + pull_files_url = "%s/repos/%s/pulls/%d/files?page=%d" % ( github_api_url, repo, args.pull_request_id, @@ -247,7 +250,7 @@ def main(): existing_pull_request_comments = [] # Request a maximum of 100 pages (3000 comments) for page_num in range(1, 101): - pull_comments_url = "%s/repos/%s/pulls/%s/comments?page=%d" % ( + pull_comments_url = "%s/repos/%s/pulls/%d/comments?page=%d" % ( github_api_url, repo, args.pull_request_id, @@ -307,7 +310,7 @@ def main(): ) current_review += 1 - pull_request_reviews_url = "%s/repos/%s/pulls/%s/reviews" % ( + pull_request_reviews_url = "%s/repos/%s/pulls/%d/reviews" % ( github_api_url, repo, args.pull_request_id,