From a26969483461a1e9e57f4c20ebc0cb52ba4d85b7 Mon Sep 17 00:00:00 2001 From: chenshoulin Date: Mon, 19 Oct 2026 21:03:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20runner=20=E6=94=B9=E7=94=A8=20github?= =?UTF-8?q?=5Fmirror=20=E6=8C=87=E5=90=91=20gitea.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - v5.1.1 不读 DEFAULT_ACTIONS_URL 环境变量(二进制里只暴露 github_mirror), 改为配置 runner.github_mirror: https://gitea.com,否则 checkout 会去访问不通的 github.com - systemd 单元去掉无效的 DEFAULT_ACTIONS_URL,避免误导 - 新增 .gitattributes,shell 脚本与服务配置强制 LF --- .gitattributes | 4 ++++ deploy/gitea-runner.config.yaml | 4 +++- deploy/gitea-runner.service | 3 +-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eb3dd3c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Shell 脚本必须保持 LF:CRLF 会让 bash 报 $'\r': command not found +*.sh text eol=lf +*.service text eol=lf +*.conf text eol=lf diff --git a/deploy/gitea-runner.config.yaml b/deploy/gitea-runner.config.yaml index acbec12..35fc938 100644 --- a/deploy/gitea-runner.config.yaml +++ b/deploy/gitea-runner.config.yaml @@ -2,7 +2,8 @@ # # 宿主模式(host):任务直接在本机执行,不额外起容器。 # 本机已装 Node 22,所以 ubuntu-latest 标签映射到 host 而不是 docker 镜像。 -# action 源通过 systemd 的 DEFAULT_ACTIONS_URL 指向 gitea.com(本机访问 github.com 不通)。 +# 本机访问 github.com 不通:用 github_mirror 把 action 源替换成 gitea.com +# (v5 只认这个配置项,DEFAULT_ACTIONS_URL 环境变量对它无效)。 log: level: info @@ -13,6 +14,7 @@ runner: timeout: 3h labels: - 'ubuntu-latest:host' + github_mirror: 'https://gitea.com' fetch_timeout: 5s fetch_interval: 2s diff --git a/deploy/gitea-runner.service b/deploy/gitea-runner.service index 314d3a3..d634589 100644 --- a/deploy/gitea-runner.service +++ b/deploy/gitea-runner.service @@ -8,8 +8,7 @@ Wants=network-online.target Type=simple WorkingDirectory=/opt/act_runner Environment=HOME=/root -# 本机访问 github.com 不通,action 改从 gitea.com 拉取 -Environment=DEFAULT_ACTIONS_URL=https://gitea.com +# action 源在 config.yaml 的 runner.github_mirror 里配置(v5 不认 DEFAULT_ACTIONS_URL) ExecStart=/usr/local/bin/gitea-runner daemon Restart=always RestartSec=5