merge: PR #30을 합친 검사 브랜치에 넣는다
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 1112/08-13. What a failed `ci:gate` prints to stderr: the gate, the command
|
||||
* that failed (or that none did), the log with the whole output, and the end
|
||||
* of that output, where the cause usually is.
|
||||
*/
|
||||
export function formatGateFailure(input: Readonly<{
|
||||
gateId: string;
|
||||
gateName: string;
|
||||
logPath: string;
|
||||
failedCommand?: string | undefined;
|
||||
output: readonly string[];
|
||||
tailLines?: number;
|
||||
}>): string {
|
||||
const tail = input.output
|
||||
.flatMap((chunk) => chunk.split(/\r?\n/u))
|
||||
.filter((line) => line.trim() !== "")
|
||||
.slice(-(input.tailLines ?? 20));
|
||||
return [
|
||||
`${input.gateId} ${input.gateName}: FAIL`,
|
||||
` failed command: ${input.failedCommand ?? "none (a check outside the commands)"}`,
|
||||
` log: ${input.logPath}`,
|
||||
" last lines of the log:",
|
||||
...tail.map((line) => ` ${line}`),
|
||||
].join("\n");
|
||||
}
|
||||
Reference in New Issue
Block a user