完成作业
This commit is contained in:
parent
750af38ff5
commit
257c1a91ed
@ -123,31 +123,24 @@ jobs:
|
|||||||
HOST=$(echo "${{ github.server_url }}" | sed 's|https\?://||' | cut -d'/' -f1)
|
HOST=$(echo "${{ github.server_url }}" | sed 's|https\?://||' | cut -d'/' -f1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 尝试使用课程主组织获取测试仓库
|
ORG=$(echo "${{ github.repository }}" | cut -d'/' -f1)
|
||||||
# 如果测试仓库在学生组织中不存在,可能在课程组织中
|
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
|
||||||
# 使用空格分隔的字符串替代bash数组,以提高兼容性
|
|
||||||
POTENTIAL_ORGS="vibevault-course course-assets vibevault-main final-vibevault"
|
|
||||||
|
|
||||||
# 直接使用正确的测试仓库名
|
# Extract assignment ID
|
||||||
ASSIGNMENT_ID="final-vibevault"
|
if echo "$REPO_NAME" | grep -q -- '-stu_'; then
|
||||||
|
ASSIGNMENT_ID=$(echo "$REPO_NAME" | sed 's/-stu_.*//')
|
||||||
|
elif echo "$REPO_NAME" | grep -q -- '-template'; then
|
||||||
|
ASSIGNMENT_ID=$(echo "$REPO_NAME" | sed 's/-template.*//')
|
||||||
|
else
|
||||||
|
ASSIGNMENT_ID="final-vibevault"
|
||||||
|
fi
|
||||||
|
|
||||||
# 尝试从多个可能的组织中克隆测试仓库
|
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 [ ! -d "_priv_tests" ]; then
|
|
||||||
echo "❌ Failed to clone ${ASSIGNMENT_ID}-tests repository from any organization!"
|
if ! git -c http.sslVerify=false clone --depth=1 "$AUTH_URL" _priv_tests 2>&1; then
|
||||||
|
echo "❌ Failed to clone ${ASSIGNMENT_ID}-tests repository!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user