fix: streamline pr and release workflow (#289)
Co-authored-by: sck_0 <samujackson1337@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ const TOOL_TESTS = path.join(TOOL_SCRIPTS, "tests");
|
||||
const LOCAL_TEST_COMMANDS = [
|
||||
[path.join(TOOL_TESTS, "jetski_gemini_loader.test.js")],
|
||||
[path.join(TOOL_TESTS, "validate_skills_headings.test.js")],
|
||||
[path.join(TOOL_TESTS, "workflow_contracts.test.js")],
|
||||
[path.join(TOOL_SCRIPTS, "run-python.js"), path.join(TOOL_TESTS, "test_validate_skills_headings.py")],
|
||||
];
|
||||
const NETWORK_TEST_COMMANDS = [
|
||||
|
||||
68
tools/scripts/tests/workflow_contracts.test.js
Normal file
68
tools/scripts/tests/workflow_contracts.test.js
Normal file
@@ -0,0 +1,68 @@
|
||||
const assert = require("assert");
|
||||
|
||||
const {
|
||||
classifyChangedFiles,
|
||||
extractChangelogSection,
|
||||
getDirectDerivedChanges,
|
||||
hasIssueLink,
|
||||
hasQualityChecklist,
|
||||
requiresReferencesValidation,
|
||||
} = require("../../lib/workflow-contract");
|
||||
|
||||
const contract = {
|
||||
derivedFiles: [
|
||||
"CATALOG.md",
|
||||
"skills_index.json",
|
||||
"data/skills_index.json",
|
||||
"data/catalog.json",
|
||||
"data/bundles.json",
|
||||
"data/aliases.json",
|
||||
],
|
||||
mixedFiles: ["README.md"],
|
||||
releaseManagedFiles: ["CHANGELOG.md", "package.json", "package-lock.json", "README.md"],
|
||||
};
|
||||
|
||||
const skillOnly = classifyChangedFiles(["skills/example/SKILL.md"], contract);
|
||||
assert.deepStrictEqual(skillOnly.categories, ["skill"]);
|
||||
assert.strictEqual(skillOnly.primaryCategory, "skill");
|
||||
assert.strictEqual(requiresReferencesValidation(["skills/example/SKILL.md"], contract), false);
|
||||
|
||||
const docsOnly = classifyChangedFiles(["README.md", "docs/users/faq.md"], contract);
|
||||
assert.deepStrictEqual(docsOnly.categories, ["docs"]);
|
||||
assert.strictEqual(docsOnly.primaryCategory, "docs");
|
||||
assert.strictEqual(requiresReferencesValidation(["README.md"], contract), true);
|
||||
|
||||
const infraChange = classifyChangedFiles([".github/workflows/ci.yml", "tools/scripts/pr_preflight.js"], contract);
|
||||
assert.deepStrictEqual(infraChange.categories, ["infra"]);
|
||||
assert.strictEqual(infraChange.primaryCategory, "infra");
|
||||
assert.strictEqual(requiresReferencesValidation(["tools/scripts/pr_preflight.js"], contract), true);
|
||||
|
||||
const mixedChange = classifyChangedFiles(["skills/example/SKILL.md", "README.md"], contract);
|
||||
assert.deepStrictEqual(mixedChange.categories, ["skill", "docs"]);
|
||||
assert.strictEqual(mixedChange.primaryCategory, "skill");
|
||||
|
||||
assert.deepStrictEqual(
|
||||
getDirectDerivedChanges(["skills/example/SKILL.md", "data/catalog.json"], contract),
|
||||
["data/catalog.json"],
|
||||
);
|
||||
|
||||
const changelog = [
|
||||
"## [7.7.0] - 2026-03-13 - \"Merge Friction Reduction\"",
|
||||
"",
|
||||
"- Line one",
|
||||
"",
|
||||
"## [7.6.0] - 2026-03-01 - \"Older Release\"",
|
||||
"",
|
||||
"- Older line",
|
||||
"",
|
||||
].join("\n");
|
||||
|
||||
assert.strictEqual(
|
||||
extractChangelogSection(changelog, "7.7.0"),
|
||||
"## [7.7.0] - 2026-03-13 - \"Merge Friction Reduction\"\n\n- Line one\n",
|
||||
);
|
||||
|
||||
assert.strictEqual(hasQualityChecklist("## Quality Bar Checklist\n- [x] Standards"), true);
|
||||
assert.strictEqual(hasQualityChecklist("No template here"), false);
|
||||
assert.strictEqual(hasIssueLink("Fixes #123"), true);
|
||||
assert.strictEqual(hasIssueLink("Related to #123"), false);
|
||||
Reference in New Issue
Block a user