All files / infrastructure/scripts/src/ship/domain report.ts

100% Statements 8/8
100% Branches 8/8
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                        2x 9x 6x 3x     6x          
interface ShipOutcome {
    checksPassed: boolean;
    merged: boolean;
}
 
interface ShipReport {
    message: string;
    exitCode: number | undefined;
    syncMaster: boolean;
}
 
/** A passed check can still be unmerged because auto-merge only queues the merge. */
export const shipMessage = ({ checksPassed, merged }: ShipOutcome): string => {
    if (!checksPassed) return "❌ a check failed — PR left open.";
    if (merged) return "✅ pipelines green, PR auto-merged.";
    return "✅ pipelines green, merge queued — should land shortly.";
};
 
export const shipReport = (outcome: ShipOutcome): ShipReport => ({
    message: shipMessage(outcome),
    exitCode: outcome.checksPassed ? undefined : 1,
    syncMaster: outcome.checksPassed && outcome.merged,
});