Files
SnowLuma/tools/check-action-catalog.mjs
DrSmoothl 26fe4e5fb5 chore(release): run the full CI suite before bumping a version
A local release now has to pass the same install, tests, catalog,
typecheck, build, and lint steps as GitHub CI, so a broken tree
cannot be tagged.
2026-09-13 20:46:43 +08:00

40 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
// Same catalog gate as the CI `test` job. Keep the git invocation and
// failure text in lockstep with `.github/workflows/ci.yml`.
import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
function runGit(args, { inherit = false } = {}) {
return spawnSync('git', args, {
cwd: repoRoot,
encoding: 'utf-8',
stdio: inherit ? 'inherit' : ['ignore', 'pipe', 'pipe'],
});
}
const status = runGit([
'status',
'--porcelain=v1',
'--untracked-files=all',
'--',
'packages/mcp/src/generated',
]);
if (status.status !== 0) {
process.stderr.write(status.stderr || 'git status failed\n');
process.exit(status.status === null ? 1 : status.status);
}
const catalogStatus = (status.stdout || '').trim();
if (!catalogStatus) process.exit(0);
runGit(['diff', '--', 'packages/mcp/src/generated'], { inherit: true });
process.stdout.write(`${catalogStatus}\n`);
process.stderr.write(
'::error::Generated action catalog is stale. Run `pnpm --filter @snowluma/mcp gen` and commit packages/mcp/src/generated/.\n',
);
process.exit(1);