FIX: Exclude deleted files from the PHPStan/Phan changed-files CI script

get_changed_php.sh listed every file the GitHub PR-files API reports,
including ones with status "removed" — deleted files no longer exist
on disk, so passing them to phpstan/phan made the CI job fail trying
to analyse a missing path. Any PR deleting PHP files hits this, not
specific to one branch; exposed here since this PR removes 79 files.
This commit is contained in:
Frédéric FRANCE 2026-08-12 07:10:32 +02:00
parent 8b96cbf1ba
commit e746e56126
No known key found for this signature in database
GPG key ID: C06E4A9656127239

View file

@ -62,13 +62,15 @@ while true; do
# Filter for files ending with .php and add them to the list
mapfile -t files < <(echo "$response" | jq -r '.[] | select((.filename | test("\\.php$")) and (.filename | test("^dev/") | not)) | .filename')
# Deleted files (status "removed") are excluded: they no longer exist on disk, so
# passing them to phpstan/phan would just fail trying to analyse a missing path.
mapfile -t files < <(echo "$response" | jq -r '.[] | select((.filename | test("\\.php$")) and (.filename | test("^dev/") | not) and (.status != "removed")) | .filename')
changed_php_files+=("${files[@]}")
mapfile -t files < <(echo "$response" | jq -r '.[] | select((.filename | test("\\.php$")) and (.filename | test("'"$phan_directory_list"'"))) | .filename' | grep -vP "$phan_exclude_file_regex")
mapfile -t files < <(echo "$response" | jq -r '.[] | select((.filename | test("\\.php$")) and (.filename | test("'"$phan_directory_list"'")) and (.status != "removed")) | .filename' | grep -vP "$phan_exclude_file_regex")
changed_phan_files+=("${files[@]}")
mapfile -t files < <(echo "$response" | jq -r '.[] | select(.filename | test("\\.lang$")) | .filename')
mapfile -t files < <(echo "$response" | jq -r '.[] | select((.filename | test("\\.lang$")) and (.status != "removed")) | .filename')
changed_lang_files+=("${files[@]}")
# Check if we have reached the last page (less than per_page results)