From 68995ccd0cd8201185e5c62a52f9c97a89aab1b9 Mon Sep 17 00:00:00 2001 From: Qingyu Wang <40660121+colinaaa@users.noreply.github.com> Date: Thu, 17 Apr 2025 19:53:16 +0800 Subject: [PATCH] ci: update fetch command in workflow to use upstream references Modified the GitHub Actions workflow to fetch branches from the upstream remote instead of the origin. This change ensures that the correct base branch is used during CI processes, addressing potential issues with branch merging and CI failures. --- .github/workflows/workflow-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow-build.yml b/.github/workflows/workflow-build.yml index 5396f21638..68dd678654 100644 --- a/.github/workflows/workflow-build.yml +++ b/.github/workflows/workflow-build.yml @@ -40,11 +40,11 @@ jobs: UPSTREAM_REMOTE: ${{ github.server_url }}/${{ github.repository }} run: | git remote add upstream $UPSTREAM_REMOTE - git fetch --progress --depth=1 upstream "+refs/heads/$CLEAN_BASE_REF:refs/heads/$CLEAN_BASE_REF" + git fetch --progress --depth=1 upstream "+refs/heads/$CLEAN_BASE_REF:refs/remotes/upstream/$CLEAN_BASE_REF" MAX_ATTEMPTS=10 ATTEMPT=0 - while [ -z "$( git merge-base "refs/heads/$CLEAN_BASE_REF" "$CLEAN_HEAD_REF" )" ] && [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; do - git fetch -q --deepen=10 upstream "refs/heads/$CLEAN_BASE_REF" + while [ -z "$( git merge-base "refs/remotes/upstream/$CLEAN_BASE_REF" "$CLEAN_HEAD_REF" )" ] && [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; do + git fetch -q --deepen=10 upstream "refs/heads/$CLEAN_BASE_REF:refs/remotes/upstream/$CLEAN_BASE_REF" git fetch -q --deepen=10 origin "$CLEAN_HEAD_REF" ATTEMPT=$((ATTEMPT + 1)) done