From 2056cc2f4791cbe52ab4dbe2e8484df25c55bcb3 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <150945400+nguyenalex836@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:11:20 -0700 Subject: [PATCH] Use merge-base for git diff in get-changed-files.sh (#57487) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Sarah Schneider --- .github/actions/get-changed-files/get-changed-files.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/get-changed-files/get-changed-files.sh b/.github/actions/get-changed-files/get-changed-files.sh index c9e25549f1..a2f49f8b0d 100755 --- a/.github/actions/get-changed-files/get-changed-files.sh +++ b/.github/actions/get-changed-files/get-changed-files.sh @@ -18,8 +18,9 @@ git fetch --depth=1 origin main git fetch --depth=1 origin ${INPUT_HEAD:-HEAD} # Get diff with status information +# Find the merge-base (common ancestor) instead of using origin/main directly echo "__ running git diff with status __" -DIFF_OUTPUT=$(git diff --name-status origin/main origin/${INPUT_HEAD:-HEAD}) +DIFF_OUTPUT=$(git diff --name-status origin/main...origin/${INPUT_HEAD:-HEAD}) # Function to extract files by pattern from diff output extract_files() {