File tree 1 file changed +17
-1
lines changed
.github/actions/get-changed-files
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
31
31
echo " __ using branch name $INPUT_HEAD __"
32
32
git fetch origin main --depth 1
33
33
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
35
51
fi
36
52
37
53
# So we can inspect the output
You can’t perform that action at this time.
0 commit comments