File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
.github/actions/get-changed-files Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,23 @@ if [ -z "$DIFF" ]; then
3131 echo " __ using branch name $INPUT_HEAD __"
3232 git fetch origin main --depth 1
3333 echo " __ running git diff __"
34- DIFF=$( git diff --name-only origin/main $INPUT_HEAD )
34+
35+ temp_file=$( mktemp)
36+ git diff --name-only origin/main $INPUT_HEAD > " $temp_file " 2> /dev/null
37+ GIT_EXIT_CODE=$?
38+
39+ DIFF=$( cat " $temp_file " )
40+ rm -f " $temp_file "
41+
42+ if [ $GIT_EXIT_CODE -ne 0 ]; then
43+ echo " __ git diff failed with exit code $GIT_EXIT_CODE , fetching unshallow __"
44+ git fetch --depth=100 origin $INPUT_HEAD
45+ git diff --name-only origin/main $INPUT_HEAD > " $temp_file " 2> /dev/null
46+ DIFF=$( cat " $temp_file " )
47+ rm -f " $temp_file "
48+ else
49+ echo " __ git diff succeeded __"
50+ fi
3551fi
3652
3753# So we can inspect the output
You can’t perform that action at this time.
0 commit comments