Skip to content

Commit f6860eb

Browse files
committed
fix: notags failed.
1 parent cc0568f commit f6860eb

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Diff for: .circleci/test-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- image: cimg/base:stable
3232
steps:
3333
- git-shallow-clone/checkout_advanced:
34-
clone_options: "--depth 1"
34+
clone_options: "--depth 1 --no-tags"
3535
fetch_options: "--depth 1000 --no-tags"
3636
tag_fetch_options: "--no-tags"
3737
# should be no tags on PR. should be 1 tag on tag push.

Diff for: src/commands/checkout.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,31 @@ steps:
9393
git config --global url."ssh://[email protected]".insteadOf "https://github.com" || true
9494
git config --global gc.auto 0 || true
9595
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
10197
if [ -n "$CIRCLE_TAG" ]; then
10298
# only tags operation have default --tags. others will no tag options
103-
tag_args="--tags"
99+
clone_tag_args=
100+
fetch_tag_args="--tags"
104101
fi
105102
if [ '<< parameters.no_tags >>' == 'true' ]; then
106-
tag_args="--no-tags"
103+
clone_tag_args="--no-tags"
104+
fetch_tag_args="--no-tags"
107105
fi
108106
107+
# checkout
108+
git clone ${clone_tag_args} --depth << parameters.depth >> $CIRCLE_REPOSITORY_URL "<< parameters.path >>"
109+
cd "<< parameters.path >>"
110+
109111
# Fetch remote and check the commit ID of the checked out code (sh version of bash `elif [[ "$CIRCLE_BRANCH" =~ ^pull\/* ]]`)
110112
if [ -n "$CIRCLE_TAG" ]; then
111113
# 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}"
113115
elif [[ $(echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+$) ]]; then
114116
# 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}"
116118
else
117119
# 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"
119121
fi
120122
121123
# Check the commit ID of the checked out code

0 commit comments

Comments
 (0)