Skip to content

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mandeepnh5 committed Dec 31, 2024
1 parent 2504d44 commit 62822f6
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/scripts/validate-coderabbit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 '.'
Expand Down

0 comments on commit 62822f6

Please sign in to comment.