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