From d35cc436dcf95f4d42b162757d379c50a61223d9 Mon Sep 17 00:00:00 2001 From: Aurelio <19254254+Aureliolo@users.noreply.github.com> Date: Wed, 11 Mar 2026 21:08:02 +0100 Subject: [PATCH 1/2] fix: use Cloudflare Pages API default per_page for pagination Cloudflare Pages deployments API rejects per_page=100 when combined with the page parameter. Use per_page=25 (the documented default) to stay within API limits while still paginating correctly. --- .github/workflows/pages-preview.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pages-preview.yml b/.github/workflows/pages-preview.yml index 72bfc1754a..56f1cefba7 100644 --- a/.github/workflows/pages-preview.yml +++ b/.github/workflows/pages-preview.yml @@ -262,13 +262,15 @@ jobs: # Paginate through all deployments for this branch # Note: Cloudflare prevents deleting the most recent deployment per project — that one will remain + # Cloudflare Pages API rejects per_page=100 with page param; use default (25) echo "Fetching deployments for branch ${BRANCH}..." + PER_PAGE=25 PAGE=1 DEPLOYMENTS="" while :; do CURL_EXIT=0 RESPONSE=$(curl -s -w "\n%{http_code}" \ - "${API_BASE}?per_page=100&page=${PAGE}" \ + "${API_BASE}?per_page=${PER_PAGE}&page=${PAGE}" \ -H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}") || CURL_EXIT=$? HTTP_CODE=$(echo "$RESPONSE" | tail -1) BODY=$(echo "$RESPONSE" | sed '$d') @@ -302,7 +304,7 @@ jobs: fi PAGE_COUNT=$(echo "$BODY" | jq -r '.result | length') - [ "$PAGE_COUNT" -lt 100 ] && break + [ "$PAGE_COUNT" -lt "$PER_PAGE" ] && break PAGE=$((PAGE + 1)) done From 290e98302b74109670ccad8fececd9af27b00ef4 Mon Sep 17 00:00:00 2001 From: Aurelio <19254254+Aureliolo@users.noreply.github.com> Date: Wed, 11 Mar 2026 21:23:05 +0100 Subject: [PATCH 2/2] fix: clarify per_page comment per Copilot review feedback --- .github/workflows/pages-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages-preview.yml b/.github/workflows/pages-preview.yml index 56f1cefba7..0a5f6479f6 100644 --- a/.github/workflows/pages-preview.yml +++ b/.github/workflows/pages-preview.yml @@ -262,7 +262,7 @@ jobs: # Paginate through all deployments for this branch # Note: Cloudflare prevents deleting the most recent deployment per project — that one will remain - # Cloudflare Pages API rejects per_page=100 with page param; use default (25) + # Cloudflare Pages API rejects per_page=100 with page param; explicitly use documented default page size (25) echo "Fetching deployments for branch ${BRANCH}..." PER_PAGE=25 PAGE=1