Skip to content

Commit 2056cc2

Browse files
nguyenalex836Copilotsarahs
authored
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 <sarahs@users.noreply.github.com>
1 parent bada255 commit 2056cc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/actions/get-changed-files/get-changed-files.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ git fetch --depth=1 origin main
1818
git fetch --depth=1 origin ${INPUT_HEAD:-HEAD}
1919

2020
# Get diff with status information
21+
# Find the merge-base (common ancestor) instead of using origin/main directly
2122
echo "__ running git diff with status __"
22-
DIFF_OUTPUT=$(git diff --name-status origin/main origin/${INPUT_HEAD:-HEAD})
23+
DIFF_OUTPUT=$(git diff --name-status origin/main...origin/${INPUT_HEAD:-HEAD})
2324

2425
# Function to extract files by pattern from diff output
2526
extract_files() {

0 commit comments

Comments
 (0)