fix: 可见性校正改用 Gitee 仓库更新端点(企业仓端点无效)
mirror-to-gitee / mirror (push) Successful in 4s

This commit is contained in:
技小云
2026-11-04 11:17:26 +08:00
committed by MiFaZhan
parent 84130087c4
commit fb2d82095d
+7 -4
View File
@@ -97,14 +97,17 @@ jobs:
fi
echo "✅ 校验通过:Gitee 端 main 与 tag 均已对齐"
# 门户是公开项目门户,目标仓必须是公开的,否则不会出现在企业仓列表页里
# 门户是公开项目门户,目标仓必须是公开的,否则不会出现在企业仓列表页里。
# 仓库可见性的更新端点是 PATCH /api/v5/repos/{owner}/{repo};
# /enterprises/{owner}/repos/{repo} 不是有效端点(会 404)。
# 企业仓可见性有三档(公开 / 企业内 / 私有),公开需要 private 与 internal 都为 false。
echo "----- 校正目标仓可见性为公开"
curl -sS -X PATCH \
"https://gitee.com/api/v5/enterprises/${DST_OWNER}/repos/${REPO_NAME}?access_token=${DST_TOKEN}" \
"https://gitee.com/api/v5/repos/${DST_OWNER}/${REPO_NAME}?access_token=${DST_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{"private":false}' \
-d '{"private":false,"internal":false}' \
-o /tmp/repo-patch.json -w '改可见性 HTTP %{http_code}\n' || true
head -c 200 /tmp/repo-patch.json 2>/dev/null; echo
head -c 300 /tmp/repo-patch.json 2>/dev/null; echo
exit 0
fi
wait_s=$((attempt * 30))