From dcb6ad693b89dd08e2d9792ad980c36c89245d1c Mon Sep 17 00:00:00 2001 From: richblack Date: Tue, 11 Aug 2026 13:33:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(build-worker-artifacts):=20dirty=20?= =?UTF-8?q?=E5=88=A4=E6=96=B7=E6=8E=92=E9=99=A4=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E8=BC=B8=E5=87=BA=E7=9B=AE=E9=8C=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .worker-builds/ 是本腳本的輸出,在成品寫出、commit 之前永遠是 untracked—— 拿它判斷「原始碼乾不乾淨」是自己把自己判成髒的假陽性。git status pathspec 排除 .worker-builds 後才是「原始碼有沒有未 commit 變更」的真實訊號。 Co-Authored-By: Claude Opus 5 --- scripts/build-worker-artifacts.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/build-worker-artifacts.mjs b/scripts/build-worker-artifacts.mjs index e55c39d..61d0566 100644 --- a/scripts/build-worker-artifacts.mjs +++ b/scripts/build-worker-artifacts.mjs @@ -131,7 +131,10 @@ function sourceCommitFor(dir) { function repoHead() { try { const sha = execSync('git rev-parse HEAD', { cwd: REPO, encoding: 'utf8' }).trim(); - const dirty = execSync('git status --porcelain', { cwd: REPO, encoding: 'utf8' }).trim(); + // .worker-builds 是本腳本自己的輸出目錄——它在「寫出成品之前」永遠是 untracked, + // 拿它判斷「原始碼乾不乾淨」是假陽性(自己把自己判成髒)。排除掉才是真正的 + // 「原始碼有沒有未 commit 的變更」。 + const dirty = execSync('git status --porcelain -- . ":(exclude).worker-builds"', { cwd: REPO, encoding: 'utf8' }).trim(); return { sha, dirty: !!dirty }; } catch { return { sha: null, dirty: null };