From a8c7673b528e66dbe5f8c0618d76b5ea8173f65c Mon Sep 17 00:00:00 2001 From: Aleksandr Meshchriakov Date: Tue, 10 Feb 2026 11:15:21 +0100 Subject: [PATCH] fix: use GITHUB_HEAD_REF for PR checkout in CI Co-Authored-By: Warp --- .gitea/workflows/ci-cd.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 2111f17..106a7ef 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -26,7 +26,8 @@ jobs: - name: Checkout code run: | REPO_URL=$(echo "${GITHUB_SERVER_URL}" | sed "s|://|://oauth2:${{ gitea.token }}@|") - git clone --depth=1 --branch="${GITHUB_REF_NAME}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . + BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" + git clone --depth=1 --branch="${BRANCH}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" - name: Install Python and uv @@ -67,7 +68,8 @@ jobs: - name: Checkout code run: | REPO_URL=$(echo "${GITHUB_SERVER_URL}" | sed "s|://|://oauth2:${{ gitea.token }}@|") - git clone --depth=1 --branch="${GITHUB_REF_NAME}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . + BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" + git clone --depth=1 --branch="${BRANCH}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" - name: Install Python and uv @@ -108,7 +110,8 @@ jobs: - name: Checkout code run: | REPO_URL=$(echo "${GITHUB_SERVER_URL}" | sed "s|://|://oauth2:${{ gitea.token }}@|") - git clone --depth=1 --branch="${GITHUB_REF_NAME}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . + BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" + git clone --depth=1 --branch="${BRANCH}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" - name: Build and push images @@ -165,7 +168,8 @@ jobs: - name: Checkout code run: | REPO_URL=$(echo "${GITHUB_SERVER_URL}" | sed "s|://|://oauth2:${{ gitea.token }}@|") - git clone --depth=1 --branch="${GITHUB_REF_NAME}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . + BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" + git clone --depth=1 --branch="${BRANCH}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" - name: Deploy via SSH @@ -212,7 +216,8 @@ jobs: - name: Checkout code run: | REPO_URL=$(echo "${GITHUB_SERVER_URL}" | sed "s|://|://oauth2:${{ gitea.token }}@|") - git clone --depth=1 --branch="${GITHUB_REF_NAME}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . + BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" + git clone --depth=1 --branch="${BRANCH}" "${REPO_URL}/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" - name: Deploy via SSH