From e388e1b8b310f1c5e17c5dd6985ba6d98ca83434 Mon Sep 17 00:00:00 2001 From: BukeLy Date: Mon, 2 Mar 2026 18:01:34 +0800 Subject: [PATCH] Fix backfill pagination: use raw count instead of filtered count The pagination loop was breaking early because it checked the count of jq-filtered results rather than the raw API response count. --- .github/workflows/backfill-dedupe.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backfill-dedupe.yml b/.github/workflows/backfill-dedupe.yml index 10060f0..0c47b4b 100644 --- a/.github/workflows/backfill-dedupe.yml +++ b/.github/workflows/backfill-dedupe.yml @@ -41,12 +41,12 @@ jobs: ISSUES="" PAGE=1 while true; do + RAW_COUNT=$(gh issue list --repo "$REPO" --state open --limit 100 --page "$PAGE" --json number | jq 'length') BATCH=$(gh issue list --repo "$REPO" --state open --limit 100 --page "$PAGE" --json number,labels,createdAt \ --jq "[.[] | select(.createdAt >= \"$SINCE\") | select([.labels[].name] | index(\"duplicate\") | not)] | .[].number") - [ -z "$BATCH" ] && break - ISSUES="$ISSUES $BATCH" - [ $(echo "$BATCH" | wc -w) -lt 100 ] && break + [ -n "$BATCH" ] && ISSUES="$ISSUES $BATCH" + [ "$RAW_COUNT" -lt 100 ] && break PAGE=$((PAGE + 1)) done ISSUES=$(echo "$ISSUES" | xargs)