Skip to content

Commit ee0477c

Browse files
committed
Fix branch name in CI
1 parent 4887860 commit ee0477c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

build_image.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,21 @@ detect_branch() {
3232
# 1. CI specific environment variables
3333
for var in GITHUB_HEAD_REF GITHUB_REF_NAME GIT_BRANCH CI_COMMIT_REF_NAME CI_BUILD_REF_NAME BUILD_SOURCEBRANCHNAME; do
3434
val="${!var:-}"
35-
printf '1: %s' "$val"
3635
if [ -n "$val" ]; then
3736
# Normalize refs/heads/* -> branch
3837
case "$val" in
3938
refs/heads/*) val="${val#refs/heads/}" ;;
4039
refs/tags/*) val="${val#refs/tags/}" ;;
4140
esac
42-
printf '2: %s' "$val"
41+
printf '%s' "$val"
4342
return 0
4443
fi
4544
done
4645
# 2. Direct rev-parse (gives 'HEAD' in detached state)
4746
local rp
4847
rp=$(git -C "${ROOT_DIR}" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
4948
if [ -n "$rp" ] && [ "$rp" != "HEAD" ]; then
50-
printf '3: %s' "$rp"
49+
printf '%s' "$rp"
5150
return 0
5251
fi
5352
# 3. Try to resolve first matching remote head for current commit
@@ -60,7 +59,7 @@ detect_branch() {
6059
if [ -n "$remote_head" ]; then
6160
# Trim origin/ prefix if present
6261
remote_head="${remote_head#origin/}"
63-
printf '4: %s' "$remote_head"
62+
printf '%s' "$remote_head"
6463
return 0
6564
fi
6665
fi

0 commit comments

Comments
 (0)