File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 5
5
github_token :
6
6
description : ' GITHUB_TOKEN'
7
7
default : ' ${{ github.token }}'
8
+ filter :
9
+ description : >
10
+ Partially clone against a given filter.
11
+ default : " "
12
+ use_sparse_checkout :
13
+ description : >
14
+ Wheter to use sparse-checkout
15
+ default : false
16
+ sparse_checkout :
17
+ description : >
18
+ Do a sparse checkout on given patterns.
19
+ Each pattern should be separated with a space.
20
+ default : " "
8
21
merge :
9
22
description : >
10
23
Whether to actually merge the pull request or only check whether
57
70
export GITHUB_TOKEN=${{ inputs.github_token }}
58
71
export DEBUG=${{ inputs.debug }}
59
72
export COMMENT=${{ inputs.comment }}
73
+ export FILTER=${{ inputs.filter }}
74
+ export USE_SPARSE_CHECKOUT=${{ inputs.use_sparse_checkout}}
75
+ export SPARSE_CHECKOUT="${{ inputs.sparse_checkout }}"
60
76
61
77
# github.action_path is set to $REPO.
62
78
if test "x${{ inputs.merge }}" = xtrue
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ case "${DEBUG:-0}" in
34
34
;;
35
35
esac
36
36
37
+ filter_string=" "
38
+ if [[ -n " ${FILTER:- } " ]]
39
+ then
40
+ filter_string=" --filter=${FILTER} "
41
+ fi
42
+
43
+ case " ${USE_SPARSE_CHECKOUT:- false} " in
44
+ 0 | false | False| FALSE) USE_SPARSE_CHECKOUT=false;;
45
+ 1 | true | True | TRUE) USE_SPARSE_CHECKOUT=true;;
46
+ * )
47
+ echo " Warning: Invalid value ('$USE_SPARSE_CHECKOUT ') for USE_SPARSE_CHECKOUT." >&2 ;
48
+ USE_SPARSE_CHECKOUT=false
49
+ ;;
50
+ esac
51
+
37
52
# Set to true to post a comment to the issue.
38
53
case " ${COMMENT:- true} " in
39
54
0 | never | false | FALSE) COMMENT=never;;
@@ -180,8 +195,18 @@ LOG=$(mktemp)
180
195
} | git credential approve
181
196
182
197
CLONE_URL=" ${CLONE_URL%://* } ://${GITHUB_ACTOR} @${CLONE_URL#*:// } "
183
- git clone --quiet --single-branch --filter=blob:none --branch " $BASE_REF " " $CLONE_URL " .
198
+ git clone --quiet ${filter_string} --no-checkout " $CLONE_URL " .
184
199
200
+ if [[ ${USE_SPARSE_CHECKOUT} == true ]]
201
+ then
202
+ echo " Initialize sparse-checkout"
203
+ git sparse-checkout init
204
+ if [[ -n " ${SPARSE_CHECKOUT} " ]]
205
+ then
206
+ git sparse-checkout add ${SPARSE_CHECKOUT}
207
+ fi
208
+ fi
209
+ git checkout " $BASE_REF "
185
210
BASE_SHA=" $( git rev-parse origin/$BASE_REF 2> /dev/null) "
186
211
fi
187
212
You can’t perform that action at this time.
0 commit comments