From ba481f8ca70e1c2461dcd3efc458e38c3cd24d67 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 26 Jul 2026 15:00:06 +0800 Subject: [PATCH] fix(ci): #916 fix set -e crash in pagination loop Python sys.exit(1) caused command substitution to fail under set -e. Replace exit-code-based pagination with wc -l line count check, and add || true guard to prevent early exit. --- .gitea/workflows/ci-pipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci-pipeline.yml b/.gitea/workflows/ci-pipeline.yml index 6294f54f6..e834fb87d 100755 --- a/.gitea/workflows/ci-pipeline.yml +++ b/.gitea/workflows/ci-pipeline.yml @@ -64,8 +64,9 @@ jobs: PAGE=1 while true; do API_URL="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files?limit=300&page=${PAGE}" - PAGE_FILES=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "$API_URL" | python3 -c "import sys,json; files=json.load(sys.stdin); [print(f['filename']) for f in files]; sys.exit(0 if len(files)==300 else 1)" 2>/dev/null) - HAS_MORE=$? + PAGE_FILES=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "$API_URL" | python3 -c "import sys,json; files=json.load(sys.stdin); [print(f['filename']) for f in files]; sys.exit(0 if len(files)==300 else 1)" 2>/dev/null || true) + PAGE_COUNT=$(echo "$PAGE_FILES" | wc -l) + if [ "$PAGE_COUNT" -lt 300 ]; then HAS_MORE=1; else HAS_MORE=0; fi ALL_FILES="${ALL_FILES}${PAGE_FILES}"$'\n' if [ "$HAS_MORE" != "0" ]; then break