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.
This commit is contained in:
BukeLy 2026-03-02 18:01:34 +08:00
parent 5fa180744d
commit e388e1b8b3

View file

@ -41,12 +41,12 @@ jobs:
ISSUES="" ISSUES=""
PAGE=1 PAGE=1
while true; do 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 \ 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") --jq "[.[] | select(.createdAt >= \"$SINCE\") | select([.labels[].name] | index(\"duplicate\") | not)] | .[].number")
[ -z "$BATCH" ] && break [ -n "$BATCH" ] && ISSUES="$ISSUES $BATCH"
ISSUES="$ISSUES $BATCH" [ "$RAW_COUNT" -lt 100 ] && break
[ $(echo "$BATCH" | wc -w) -lt 100 ] && break
PAGE=$((PAGE + 1)) PAGE=$((PAGE + 1))
done done
ISSUES=$(echo "$ISSUES" | xargs) ISSUES=$(echo "$ISSUES" | xargs)