Skip to content

Commit

Permalink
Fix github pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
mandeepnh5 committed Dec 31, 2024
1 parent 6868f3f commit 2504d44
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/scripts/validate-coderabbit.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash

Check warning on line 1 in .github/workflows/scripts/validate-coderabbit.sh

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
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
}
Expand All @@ -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:"
Expand Down

0 comments on commit 2504d44

Please sign in to comment.