From f5551b91bf13f1268143df9268228c8464c49164 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Fri, 11 Nov 2022 14:20:26 +0900 Subject: [PATCH 1/2] fix: api pull_request build failed due to head/head/ duplication --- src/commands/checkout_advanced.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/checkout_advanced.yml b/src/commands/checkout_advanced.yml index 6141a80..09de7ca 100644 --- a/src/commands/checkout_advanced.yml +++ b/src/commands/checkout_advanced.yml @@ -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 From 3861aa2488e37a094b407764560447995ffe5e73 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 29 Nov 2022 01:36:26 +0900 Subject: [PATCH 2/2] feat: simpler pull request check Now pull_request flow is as same as checkout --- src/commands/checkout_advanced.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/commands/checkout_advanced.yml b/src/commands/checkout_advanced.yml index 09de7ca..bfa6684 100644 --- a/src/commands/checkout_advanced.yml +++ b/src/commands/checkout_advanced.yml @@ -99,15 +99,8 @@ 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 - # pull request - 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 + elif [[ $(echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+$) ]]; then + git fetch << parameters.fetch_options >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}" else # others git fetch << parameters.fetch_options >> --force origin "${CIRCLE_BRANCH}:remotes/origin/${CIRCLE_BRANCH}"