From c4a99b4376142e3397f57e7a2fe39a0cd1e08f46 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Mon, 8 May 2023 15:04:12 +0200 Subject: [PATCH] .github: check for remote branches with git ls-remote git show-ref in check_remote_branch is not working at all, because the GitHub Actions checkout fetches a git repo with only depth 1 by default. That means only main branch is available, not any other remote branches. As a result, git show-ref always fails. Fix that by checking for remote branches by git ls-remote. --- .github/workflows/common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/common.sh b/.github/workflows/common.sh index 56251400b3..0c3b11e011 100644 --- a/.github/workflows/common.sh +++ b/.github/workflows/common.sh @@ -66,8 +66,7 @@ function prepare_git_repo() { function check_remote_branch() { local target_branch="${1}" - - if git -C "${SDK_OUTER_TOPDIR}" show-ref "remotes/origin/${target_branch}"; then + if git -C "${SDK_OUTER_TOPDIR}" ls-remote --refs --heads --exit-code origin "${target_branch}" >/dev/null; then return 1 fi return 0