ci: 用 git clone 替换 actions/checkout (alpine 无 Node)
CI / Release / CI (push) Failing after 44s
CI / Release / Release (push) Has been skipped

alpine golang-1.25 镜像没装 Node, actions/checkout@v4 启动失败:

  Run Checkout
  OCI runtime exec failed: exec failed: unable to start container
  process: exec: "node": executable file not found in \$PATH: unknown

actions/checkout 是 Node.js 应用, Gitea alpine runner 镜像不
带 Node. 改用 git clone 手写 checkout step:

  git clone --depth 1 "\${{ github.server_url }}/\${{ github.repository }}.git" .

shallow clone (\$depth 1) 减少传输量, \${{ github.server_url }} 自动
填入 Gitea 实例 URL, \${{ github.repository }} 是 owner/repo 路径.

这个 runner 应该跟 Gitea 在同一网络, 仓库公开, 不需要 auth
token. 如果将来换 runner 跨网络或者仓库私有, 改成:

  git clone --depth 1 \\
    -c http.extraHeader="Authorization: token \$GITEA_TOKEN" \\
    "\${{ github.server_url }}/\${{ github.repository }}.git" .

GITEA_TOKEN 走 \${{ secrets.GITHUB_TOKEN }} (Gitea 自动注入).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tao.chen
2026-07-15 18:45:31 +08:00
co-authored by Claude
parent e5f7d661b4
commit 160c9f32c8
+10 -2
View File
@@ -22,7 +22,12 @@ jobs:
runs-on: golang-1.25
steps:
- name: Checkout
uses: actions/checkout@v4
run: |
# Manual git checkout — actions/checkout needs Node, which the
# alpine golang-1.25 image doesn't have.
# Gitea runner doesn't expose a token for clone in the usual
# way; for a same-network runner the repo URL is enough.
git clone --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" .
- name: Set GOPROXY
run: |
@@ -64,7 +69,10 @@ jobs:
runs-on: golang-1.25
steps:
- name: Checkout
uses: actions/checkout@v4
run: |
# Manual git checkout — actions/checkout needs Node, which the
# alpine golang-1.25 image doesn't have.
git clone --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" .
- name: Set GOPROXY
run: |