s2 / scripts /ci-change-risk.mjs
xjackkx's picture
Upload 151 files
e81f4e4 verified
Raw History Blame Contribute Delete
499 Bytes
const DOC_ONLY_ROOT_FILES = new Set(["LICENSE", "README.md", "README.zh.md"]);
export function classifyChangedFiles(files) {
const normalized = files
.map((file) =>
String(file || "")
.replaceAll("\\", "/")
.trim(),
)
.filter(Boolean);
if (!normalized.length) return "runtime";
return normalized.every(isDocumentationOnlyPath) ? "docs" : "runtime";
}
function isDocumentationOnlyPath(path) {
if (DOC_ONLY_ROOT_FILES.has(path)) return true;
return path.startsWith("docs/");
}