chore: enforce scorecard preflight in release flow

This commit is contained in:
waaraawa 2026-06-17 10:08:18 +09:00 committed by waaraawa
parent 98e42aea3d
commit d7f0aaea24
2 changed files with 13 additions and 0 deletions

View file

@ -30,6 +30,9 @@ jobs:
- name: Run tests
run: npm test
- name: Run Scorecard preflight
run: npm run check:scorecard
- name: Build
run: npm run build

View file

@ -1,5 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
const ROOT = process.cwd();
const IGNORED_DIRS = new Set(['coverage', 'dist', 'node_modules']);
@ -57,6 +58,15 @@ addCheck('Committed npm lockfile exists', () => {
if (!fs.existsSync(lockfile)) {
throw new Error('package-lock.json is required for reproducible dependency resolution');
}
try {
execFileSync('git', ['ls-files', '--error-unmatch', 'package-lock.json'], {
cwd: ROOT,
stdio: 'ignore',
});
} catch {
throw new Error('package-lock.json must be tracked by Git');
}
});
addCheck('Release workflow includes artifact attestation', () => {