From 02c38c3a9b157e6579e609bfbbb81182bb9f04e8 Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 29 Mar 2026 02:07:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(runner):=20=E4=BF=9D=E7=95=99=20=5Frunner?= =?UTF-8?q?=5Ffile=5Fcommands=20=E9=81=BF=E5=85=8D=20checkout=20=E5=A4=B1?= =?UTF-8?q?=E6=95=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 問題: 清理腳本刪除了 $RUNNER_TEMP/* 包含 _runner_file_commands 結果: "Missing file at path: _runner_file_commands/set_output_xxx" 修正: - 移除 rm -rf $RUNNER_TEMP/* (會刪除關鍵檔案) - Pre-flight: 使用 find 排除 _runner_file_commands - 其他 Jobs: 只清理 _diag/pages Co-Authored-By: Claude Opus 4.5 --- .github/workflows/cd.yaml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 7fc21929..eba292d4 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -88,9 +88,10 @@ jobs: echo " ✅ Cleaned _diag/pages" fi - # 2. 清理 RUNNER_TEMP - rm -rf "$RUNNER_TEMP"/* 2>/dev/null - echo " ✅ Cleaned RUNNER_TEMP" + # 2. 清理 RUNNER_TEMP (排除 _runner_file_commands) + # 注意: 不能刪除整個目錄,否則會破壞 Runner 內部通訊 + find "$RUNNER_TEMP" -mindepth 1 -maxdepth 1 ! -name "_runner_file_commands" -exec rm -rf {} \; 2>/dev/null || true + echo " ✅ Cleaned RUNNER_TEMP (preserved _runner_file_commands)" # 3. 清理 Claude worktrees rm -rf .claude/worktrees 2>/dev/null @@ -161,10 +162,11 @@ jobs: k3s-system: ${{ steps.filter.outputs.k3s-system }} steps: # 2026-03-29: Runner 診斷檔案清理 (防止並行衝突) + # 注意: 不能刪除 $RUNNER_TEMP/* 因為包含 _runner_file_commands - name: "Clean Runner Diagnostics" run: | RUNNER_ROOT=$(dirname "$(dirname "$RUNNER_TEMP")") - rm -rf "$RUNNER_TEMP"/* "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true + rm -rf "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true mkdir -p "$RUNNER_ROOT/_diag/pages" 2>/dev/null || true - uses: actions/checkout@v4 @@ -202,10 +204,11 @@ jobs: image_tag: ${{ steps.tag.outputs.tag }} steps: # 2026-03-29: Runner 診斷檔案清理 (防止並行衝突) + # 注意: 不能刪除 $RUNNER_TEMP/* 因為包含 _runner_file_commands - name: "Clean Runner Diagnostics" run: | RUNNER_ROOT=$(dirname "$(dirname "$RUNNER_TEMP")") - rm -rf "$RUNNER_TEMP"/* "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true + rm -rf "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true mkdir -p "$RUNNER_ROOT/_diag/pages" 2>/dev/null || true - uses: actions/checkout@v4 @@ -241,10 +244,11 @@ jobs: image_tag: ${{ steps.tag.outputs.tag }} steps: # 2026-03-29: Runner 診斷檔案清理 (防止並行衝突) + # 注意: 不能刪除 $RUNNER_TEMP/* 因為包含 _runner_file_commands - name: "Clean Runner Diagnostics" run: | RUNNER_ROOT=$(dirname "$(dirname "$RUNNER_TEMP")") - rm -rf "$RUNNER_TEMP"/* "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true + rm -rf "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true mkdir -p "$RUNNER_ROOT/_diag/pages" 2>/dev/null || true - uses: actions/checkout@v4 @@ -287,10 +291,11 @@ jobs: environment: production steps: # 2026-03-29: Runner 診斷檔案清理 (防止並行衝突) + # 注意: 不能刪除 $RUNNER_TEMP/* 因為包含 _runner_file_commands - name: "Clean Runner Diagnostics" run: | RUNNER_ROOT=$(dirname "$(dirname "$RUNNER_TEMP")") - rm -rf "$RUNNER_TEMP"/* "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true + rm -rf "$RUNNER_ROOT/_diag/pages" .claude/worktrees 2>/dev/null || true mkdir -p "$RUNNER_ROOT/_diag/pages" 2>/dev/null || true - uses: actions/checkout@v4