From 2a3e5eef90ed4e9eeb143ae8c2f3e16806371aec Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 20 Mar 2026 06:55:00 +0000 Subject: [PATCH] fix: ci_required_for_pr should paginate /pulls/{pr}/files (#273) Replace single-page curl fetch with codeberg_api_all() which paginates through all pages of PR files. This ensures large PRs with 50+ files correctly detect code files on all pages, preventing CI from being incorrectly bypassed. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/ci-helpers.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ci-helpers.sh b/lib/ci-helpers.sh index 41dceb4..6deb229 100644 --- a/lib/ci-helpers.sh +++ b/lib/ci-helpers.sh @@ -24,9 +24,9 @@ diff_has_code_files() { # Returns 0 if PR has code files (CI required), 1 if non-code only (CI not required). ci_required_for_pr() { local pr_num="$1" - local files - files=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ - "${CODEBERG_API}/pulls/${pr_num}/files" | jq -r '.[].filename' 2>/dev/null) || return 0 + local files all_json + all_json=$(codeberg_api_all "/pulls/${pr_num}/files") || return 0 + files=$(printf '%s' "$all_json" | jq -r '.[].filename' 2>/dev/null) || return 0 if [ -z "$files" ]; then return 0 # empty file list — require CI as safety default fi