Skip to content

Commit 33b28f8

Browse files
committed
fix: e2e webhook call on main branch
1 parent f5c1f13 commit 33b28f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

shared-scripts.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,16 @@ function _publishToLocalRegistry {
115115
echo "Publish To Local Registry"
116116
loadCacheFromBuildJob
117117
if [ -z "$BRANCH_NAME" ]; then
118-
export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)"
119-
if [ "$BRANCH_NAME" = "" ] ; then
120-
BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')";
118+
if [ -z "$CODEBUILD_WEBHOOK_TRIGGER" ]; then
119+
export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)"
120+
if [ "$BRANCH_NAME" = "" ] ; then
121+
BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')";
122+
fi
123+
elif [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then
124+
export BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/}
121125
fi
122126
fi
127+
echo $BRANCH_NAME
123128
git checkout $BRANCH_NAME
124129

125130
# Fetching git tags from upstream

0 commit comments

Comments
 (0)