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) <noreply@anthropic.com>
This commit is contained in:
parent
e0a1c67224
commit
2a3e5eef90
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue