#!/usr/bin/env tsx /** * Check pull request hygiene (changelog + commits) * * This script inspects the current git workspace to determine whether: * - The changelog (respecting CHANGELOG_FILE env override) has been modified * - A `[skip-changelog]` marker appears in commit messages * - Commits follow the conventional commit format * * Results are written to `$GITHUB_OUTPUT` when available so GitHub Actions steps * can consume them without relying on continue-on-error semantics. */ import type { ExecSyncOptions } from 'node:child_process'; export type ChangelogStatus = 'updated' | 'skipped' | 'missing'; export type ChangelogBlockStatus = 'present' | 'absent' | 'unknown'; export interface PrCheckResult { baseRef: string | null; headRef: string; changedFiles: string[]; commits: string[]; changelogStatus: ChangelogStatus; changelogBlock: ChangelogBlockStatus; skipChangelogMarker: boolean; hasConventionalCommits: boolean; } export interface PrCheckDeps { execSync: (command: string, options?: ExecSyncOptions) => Buffer | string; getEnv: (key: string) => string | undefined; writeOutput: (name: string, value: string) => void; log: (message: string) => void; warn: (message: string) => void; } export declare function safeExec(command: string, deps: PrCheckDeps): string | null; export declare function normalizeBaseRef(baseRef: string | null | undefined): string | null; export declare function parseArgs(argv: string[]): { base: string | null; head: string | null; }; export declare function splitList(value: string | null): string[]; export declare function hasSkipChangelog(commits: string[]): boolean; export declare function hasConventionalCommits(commits: string[]): boolean; export declare function evaluateChangelogStatus(changedFiles: string[], changelogPath: string, commits: string[]): { status: ChangelogStatus; skipMarker: boolean; }; export declare function evaluateChangelogBlockStatus(deps: PrCheckDeps): ChangelogBlockStatus; export declare function getDiffRange(baseRef: string | null, headRef: string): string; export declare function runPrCheck(args: { base?: string | null; head?: string | null; }, deps: PrCheckDeps): PrCheckResult; export declare function createDefaultDeps(): PrCheckDeps; export declare function writeOutputs(result: PrCheckResult, deps: PrCheckDeps): void; export declare function renderSummary(result: PrCheckResult, deps: PrCheckDeps): void;