@@ -93,29 +93,31 @@ steps:
93
93
git config --global url."ssh://[email protected] ".insteadOf "https://github.com" || true
94
94
git config --global gc.auto 0 || true
95
95
96
- # checkout
97
- git clone --depth << parameters.depth >> $CIRCLE_REPOSITORY_URL "<< parameters.path >>"
98
- cd "<< parameters.path >>"
99
-
100
- # Define Tag Fetch args
96
+ # Define Tag args
101
97
if [ -n "$CIRCLE_TAG" ]; then
102
98
# only tags operation have default --tags. others will no tag options
103
- tag_args="--tags"
99
+ clone_tag_args=
100
+ fetch_tag_args="--tags"
104
101
fi
105
102
if [ '<< parameters.no_tags >>' == 'true' ]; then
106
- tag_args="--no-tags"
103
+ clone_tag_args="--no-tags"
104
+ fetch_tag_args="--no-tags"
107
105
fi
108
106
107
+ # checkout
108
+ git clone ${clone_tag_args} --depth << parameters.depth >> $CIRCLE_REPOSITORY_URL "<< parameters.path >>"
109
+ cd "<< parameters.path >>"
110
+
109
111
# Fetch remote and check the commit ID of the checked out code (sh version of bash `elif [[ "$CIRCLE_BRANCH" =~ ^pull\/* ]]`)
110
112
if [ -n "$CIRCLE_TAG" ]; then
111
113
# tag
112
- git fetch ${tag_args } --depth << parameters.fetch_depth >> --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
114
+ git fetch ${fetch_tag_args } --depth << parameters.fetch_depth >> --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
113
115
elif [[ $(echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+$) ]]; then
114
116
# pull request
115
- git fetch ${tag_args } --depth << parameters.fetch_depth >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
117
+ git fetch ${fetch_tag_args } --depth << parameters.fetch_depth >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
116
118
else
117
119
# others
118
- git fetch ${tag_args } --depth=<< parameters.fetch_depth >> --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
120
+ git fetch ${fetch_tag_args } --depth=<< parameters.fetch_depth >> --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
119
121
fi
120
122
121
123
# Check the commit ID of the checked out code
0 commit comments