Skip to content

Commit

Permalink
fix: api pull_request build failed due to head/head/ duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed Nov 28, 2022
1 parent 14cb80f commit f5551b9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/commands/checkout_advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ steps:
if [ -n "$CIRCLE_TAG" ]; then
# tag
git fetch << parameters.tag_fetch_options >> << parameters.fetch_options >> --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
elif [[ $(echo $CIRCLE_BRANCH | grep -e ^pull\/*) ]]; then
elif [ $(echo $CIRCLE_BRANCH | grep -e ^pull\/*) ]; then
# pull request
git fetch << parameters.fetch_options >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
if [ $(echo $CIRCLE_BRANCH | grep -e .*\/head$) ]; then
# remove /head from CIRCLE_BRANCH
headless_CIRCLE_BRANCH=$(echo $CIRCLE_BRANCH | rev | cut -c6- | rev)
git fetch << parameters.fetch_options >> --force origin "${headless_CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
else
git fetch << parameters.fetch_options >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
fi
else
# others
git fetch << parameters.fetch_options >> --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
git fetch << parameters.fetch_options >> --force origin "${CIRCLE_BRANCH}:remotes/origin/${CIRCLE_BRANCH}"
fi
# Check the commit ID of the checked out code
Expand Down

0 comments on commit f5551b9

Please sign in to comment.