From e746e56126fd0d6edfc0b0d44390258582425fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 12 Aug 2026 07:10:32 +0200 Subject: [PATCH] FIX: Exclude deleted files from the PHPStan/Phan changed-files CI script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/scripts/get_changed_php.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/scripts/get_changed_php.sh b/.github/scripts/get_changed_php.sh index 43d64101c74..f72641d6a31 100755 --- a/.github/scripts/get_changed_php.sh +++ b/.github/scripts/get_changed_php.sh @@ -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)