From 2504d443a85f15d71c12f01e85bea02df044b369 Mon Sep 17 00:00:00 2001 From: MANDEEP N H <146331633+mandeepnh5@users.noreply.github.com> Date: Tue, 31 Dec 2024 16:58:54 +0000 Subject: [PATCH] Fix github pagination --- .github/workflows/scripts/validate-coderabbit.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scripts/validate-coderabbit.sh b/.github/workflows/scripts/validate-coderabbit.sh index f9505bfa73..0fffe24ae0 100644 --- a/.github/workflows/scripts/validate-coderabbit.sh +++ b/.github/workflows/scripts/validate-coderabbit.sh @@ -1,13 +1,12 @@ #!/bin/bash echo "Step 1: Fetching all PR reviews with pagination..." -page=1 all_reviews="[]" while true; do - echo "Fetching page $page..." + echo "Fetching page..." response=$(curl -s -f -H "Authorization: token $GITHUB_TOKEN" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews?per_page=100&page=$page") || { + "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews?per_page=1000") || { echo "Error: Failed to fetch reviews from GitHub API" exit 1 } @@ -18,7 +17,6 @@ while true; do fi all_reviews=$(echo "$all_reviews" "$response" | jq -s 'add') - page=$((page + 1)) done echo "Debug: Combined reviews from all pages:"