Files
test-repo/scripts/ensure-no-files-changed.js
T
88ee8a5b3e Update babel to v8.0.0-rc.1 (#18822)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-01 08:57:18 +08:00

32 lines
738 B
JavaScript

#!/usr/bin/env node
import spawn from "nano-spawn";
async function getChangedFiles() {
const { stdout } = await spawn("git", ["diff", "--name-only"]);
return stdout.split("\n");
}
async function ensureNoFilesChanged() {
const changedFiles = await getChangedFiles();
if (changedFiles.length === 0) {
console.log("✅ No files changed.");
return;
}
console.log(
`❌ ${changedFiles.length} file${changedFiles.length === 1 ? "" : "s"} changed:`,
);
console.log(changedFiles.map((file) => ` - ${file}`).join("\n"));
console.log();
try {
await spawn("git", ["diff", "--exit-code"], { stdio: "inherit" });
} catch (error) {
process.exitCode = error.exitCode;
}
}
await ensureNoFilesChanged();