From b5b67ac1c1c7d7647f8aa74415cec7404185ea2f Mon Sep 17 00:00:00 2001 From: icarus Date: Thu, 4 Sep 2025 18:55:18 +0800 Subject: [PATCH] =?UTF-8?q?ci(workflow):=20=E4=BF=AE=E6=94=B9i18n=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E4=BB=A5=E9=9A=94=E7=A6=BB=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将全局依赖安装改为在临时目录中安装,避免污染全局环境 使用npx运行tsx以确保使用正确版本的依赖 --- .github/workflows/auto-i18n.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-i18n.yml b/.github/workflows/auto-i18n.yml index fc287aee7..b3adabb2d 100644 --- a/.github/workflows/auto-i18n.yml +++ b/.github/workflows/auto-i18n.yml @@ -29,11 +29,19 @@ jobs: with: node-version: 20 - - name: 📦 Install global dependencies - run: npm install -g openai@^5.12.2 cli-progress@^3.12.0 tsx@^4.20.3 + - name: 📦 Install dependencies in isolated directory + run: | + # 在临时目录安装依赖 + mkdir -p /tmp/translation-deps + cd /tmp/translation-deps + echo '{"dependencies": {"openai": "^5.12.2", "cli-progress": "^3.12.0", "tsx": "^4.20.3"}}' > package.json + npm install --no-package-lock + + # 设置 NODE_PATH 让项目能找到这些依赖 + echo "NODE_PATH=/tmp/translation-deps/node_modules" >> $GITHUB_ENV - name: 🏃‍♀️ Translate - run: tsx scripts/update-i18n.ts + run: npx tsx scripts/update-i18n.ts - name: 🔄 Commit changes run: |