From 62822f6d870be281bee549694ff38cc9db0caff1 Mon Sep 17 00:00:00 2001 From: MANDEEP N H <146331633+mandeepnh5@users.noreply.github.com> Date: Tue, 31 Dec 2024 17:06:14 +0000 Subject: [PATCH] Fix some issues --- .../workflows/scripts/validate-coderabbit.sh | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/scripts/validate-coderabbit.sh b/.github/workflows/scripts/validate-coderabbit.sh index 0fffe24ae0..4749ee9c90 100644 --- a/.github/workflows/scripts/validate-coderabbit.sh +++ b/.github/workflows/scripts/validate-coderabbit.sh @@ -3,21 +3,16 @@ echo "Step 1: Fetching all PR reviews with pagination..." all_reviews="[]" -while true; do - 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=1000") || { - echo "Error: Failed to fetch reviews from GitHub API" - exit 1 - } - - if [ "$(echo "$response" | jq '. | length')" -eq 0 ]; then - echo "No more reviews to fetch." - break - fi - - all_reviews=$(echo "$all_reviews" "$response" | jq -s 'add') -done + +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=1000") || { + echo "Error: Failed to fetch reviews from GitHub API" + exit 1 +} + + +all_reviews=$(echo "$all_reviews" "$response" | jq -s 'add') echo "Debug: Combined reviews from all pages:" echo "$all_reviews" | jq '.'