From 6afc94d5fbac83f5148399167a8fd32d53d0c2d6 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sun, 5 Jul 2026 20:11:38 +0900 Subject: [PATCH] Require clean tracked files before shipping --- scripts/ship-release.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/ship-release.mjs b/scripts/ship-release.mjs index 4e9dcb7..3644a94 100644 --- a/scripts/ship-release.mjs +++ b/scripts/ship-release.mjs @@ -4,6 +4,7 @@ import { join } from 'node:path'; const qaVersion = process.env.PUBLIC_QA_VERSION ?? makeQaVersion(); +assertNoTrackedChanges(); runPnpmScript('verify:local-release'); runPnpmScript('qa:early'); writeReleaseManifest(qaVersion); @@ -17,6 +18,21 @@ function makeQaVersion() { return `ship-${stamp}`; } +function assertNoTrackedChanges() { + const result = spawnSync('git', ['status', '--porcelain', '--untracked-files=no'], { + cwd: process.cwd(), + encoding: 'utf8' + }); + if (result.status !== 0) { + throw new Error(`Could not inspect tracked git status before shipping:\n${result.stderr.trim()}`); + } + + const dirty = result.stdout.trim(); + if (dirty) { + throw new Error(`Refusing to ship release with uncommitted tracked changes:\n${dirty}`); + } +} + function writeReleaseManifest(qaVersion) { const manifest = { app: 'heros_web',