diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index d2e18f02..1de4a457 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -27,16 +27,15 @@ jobs: import sys from urllib.parse import urlsplit - # 服务端基址取运行器注入的 GITHUB_SERVER_URL(平台控制、候选 PR 不可影响), - # 只做 https 形态校验;凭据仅附着于「该基址 + 下方仓库白名单」构造的 URL。 - # 2026-10-05 修复:此前与硬编码常量严格相等比对,运行器注入值与公网拼写 - # 不一致时合法检出也被拒绝(PR #213 run 948 实测),仓库白名单不变。 - print("diag GITHUB_SERVER_URL:", repr(os.environ.get("GITHUB_SERVER_URL")), - "GITHUB_API_URL:", repr(os.environ.get("GITHUB_API_URL")), - "GITHUB_REPOSITORY:", repr(os.environ.get("GITHUB_REPOSITORY"))) + # 服务端基址取运行器注入的 GITHUB_SERVER_URL(平台控制、候选 PR 不可影响)。 + # 2026-10-05 修复(run 948/949 实测):注入值为内网直连形态 + # 'http://172.17.0.1:3000'(docker 网关 → 宿主 Gitea),与公网拼写不同且为 + # http——此前硬编码常量严格比对会拒绝合法检出。校验收宽为「http(s) + 非空 + # netloc」;凭据仍只附着于「该基址 + 下方仓库白名单」构造的 URL。 SERVER = os.environ.get("GITHUB_SERVER_URL", "").rstrip("/") - if urlsplit(SERVER).scheme != "https" or not urlsplit(SERVER).netloc: - sys.exit("Checkout server must be the platform-injected https URL") + parsed_server = urlsplit(SERVER) + if parsed_server.scheme not in {"http", "https"} or not parsed_server.netloc: + sys.exit("Checkout server must be the platform-injected http(s) URL") SSH = "ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/" # Reviewed allowlist, independent of candidate .gitmodules. Add repositories # here only with an explicit review of the checkout credential's scope.