From e06e720cadd56dc72d2222be63e4d8e982484b92 Mon Sep 17 00:00:00 2001 From: mn-ram <235066282+mn-ram@users.noreply.github.com> Date: Fri, 27 Mar 2026 07:42:11 +0530 Subject: [PATCH] fix: skip PR review comment collection when pull requests are disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds on #3783 (check_prs_enabled infrastructure). Applies the same disabled-PR check to collect_pull_request_review_comments, which hits the repos/{owner}/{repo}/pulls/comments endpoint — this also returns 404 when PRs are disabled and had no prior handling. Signed-off-by: mn-ram <235066282+mn-ram@users.noreply.github.com> --- collectoss/tasks/github/pull_requests/tasks.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/collectoss/tasks/github/pull_requests/tasks.py b/collectoss/tasks/github/pull_requests/tasks.py index 3efaddf3b..c0d830c84 100644 --- a/collectoss/tasks/github/pull_requests/tasks.py +++ b/collectoss/tasks/github/pull_requests/tasks.py @@ -232,6 +232,13 @@ def collect_pull_request_review_comments(repo_git: str, full_collection: bool) - logger = logging.getLogger(collect_pull_request_review_comments.__name__) logger.debug(f"Collecting pull request review comments for {owner}/{repo}") + key_auth = GithubRandomKeyAuth(logger) + github_data_access = GithubDataAccess(key_auth, logger) + + if not github_data_access.check_prs_enabled(owner, repo): + logger.info(f"{owner}/{repo}: Pull requests appear to be disabled for this repo. Skipping review comment collection.") + return + repo_id = get_repo_by_repo_git(repo_git).repo_id if not full_collection: @@ -257,9 +264,6 @@ def collect_pull_request_review_comments(repo_git: str, full_collection: bool) - tool_version = "2.0" data_source = "Github API" - key_auth = GithubRandomKeyAuth(logger) - github_data_access = GithubDataAccess(key_auth, logger) - pr_review_comment_batch_size = get_batch_size() # Batch processing: accumulate comments until batch size reached, then flush