From adeae07283bf22279d5c5d4d5b6257a6421f150c Mon Sep 17 00:00:00 2001 From: User Date: Tue, 23 Dec 2025 20:10:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/autograde.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/autograde.yml b/.gitea/workflows/autograde.yml index 8868cd0..7ca8cdc 100644 --- a/.gitea/workflows/autograde.yml +++ b/.gitea/workflows/autograde.yml @@ -123,18 +123,30 @@ jobs: HOST=$(echo "${{ github.server_url }}" | sed 's|https\?://||' | cut -d'/' -f1) fi - ORG=$(echo "${{ github.repository }}" | cut -d'/' -f1) - REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2) + # 尝试使用课程主组织获取测试仓库 + # 如果测试仓库在学生组织中不存在,可能在课程组织中 + POTENTIAL_ORGS=("vibevault-course" "course-assets" "vibevault-main" "final-vibevault") # 直接使用正确的测试仓库名 ASSIGNMENT_ID="final-vibevault" - echo "📥 Fetching tests and grading scripts from ${ORG}/${ASSIGNMENT_ID}-tests..." + # 尝试从多个可能的组织中克隆测试仓库 + for COURSE_ORG in "${POTENTIAL_ORGS[@]}"; do + echo "📥 Trying to fetch tests from ${COURSE_ORG}/${ASSIGNMENT_ID}-tests..." + + AUTH_URL="http://${TESTS_USERNAME}:${TESTS_TOKEN}@${HOST}/${COURSE_ORG}/${ASSIGNMENT_ID}-tests.git" + + if git -c http.sslVerify=false clone --depth=1 "$AUTH_URL" _priv_tests 2>&1; then + echo "✅ Successfully cloned ${COURSE_ORG}/${ASSIGNMENT_ID}-tests!" + break + else + echo "❌ Failed to clone from ${COURSE_ORG}, trying next organization..." + fi + done - AUTH_URL="http://${TESTS_USERNAME}:${TESTS_TOKEN}@${HOST}/${ORG}/${ASSIGNMENT_ID}-tests.git" - - if ! git -c http.sslVerify=false clone --depth=1 "$AUTH_URL" _priv_tests 2>&1; then - echo "❌ Failed to clone ${ASSIGNMENT_ID}-tests repository!" + # 检查是否成功克隆了测试仓库 + if [ ! -d "_priv_tests" ]; then + echo "❌ Failed to clone ${ASSIGNMENT_ID}-tests repository from any organization!" exit 1 fi