From 26474b4752cea7744eac0d73fbce514a53ccd5b5 Mon Sep 17 00:00:00 2001 From: weichen Date: Sat, 3 Oct 2026 10:31:43 +0000 Subject: [PATCH] Clone the repo in CI without GitHub-hosted actions Why: The runner cannot reach github.com, so a checkout action would time out before vet or test. Evidence: The Go 1.27.1 tarball is available from mirrors.aliyun.com. Checkout uses the job token and GITHUB_SHA. Impact: Submodule checkout still requires SUBMODULE_TOKEN. A missing secret fails the job with that message. Refs: feature/agent-stack-r0-r1 Co-authored-by: Cursor --- .gitea/workflows/ci.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 83aeb86..b67a8fe 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -10,13 +10,28 @@ jobs: env: GOPROXY: https://goproxy.cn,direct steps: - - name: Configure submodule auth over HTTPS - run: git config --global url."https://weichen:${{ secrets.SUBMODULE_TOKEN }}@git-home.u1680832.nyat.app:30319/".insteadOf "ssh://git@git-ssh.u1680832.nyat.app:31411/" - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: actions/setup-go@v5 - with: - go-version: "1.27" + - name: Checkout + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + SUBMODULE_TOKEN: ${{ secrets.SUBMODULE_TOKEN }} + run: | + set -euo pipefail + git init -q + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + git -c http.extraheader="AUTHORIZATION: token ${TOKEN}" fetch --depth=1 origin "${GITHUB_SHA}" + git checkout -q --detach FETCH_HEAD + if [ -z "${SUBMODULE_TOKEN}" ]; then + echo "SUBMODULE_TOKEN is not configured" >&2 + exit 1 + fi + git config --global url."https://weichen:${SUBMODULE_TOKEN}@git-home.u1680832.nyat.app:30319/".insteadOf "ssh://git@git-ssh.u1680832.nyat.app:31411/" + git -c fetch.recurseSubmodules=false submodule update --init --recursive + - name: Install Go 1.27.1 + run: | + set -euo pipefail + curl -fsSL -o "$RUNNER_TEMP/go.tgz" https://mirrors.aliyun.com/golang/go1.27.1.linux-amd64.tar.gz + tar -C /usr/local -xzf "$RUNNER_TEMP/go.tgz" + ln -sfn /usr/local/go/bin/go /usr/local/bin/go + ln -sfn /usr/local/go/bin/gofmt /usr/local/bin/gofmt - name: Vet and test run: GOWORK=off go vet ./... && GOWORK=off go test -count=1 ./...