mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Truncate autobuild errors to 10 lines
This commit is contained in:
@@ -109,10 +109,13 @@ function extractFatalErrors(error: string): string | undefined {
|
||||
|
||||
function extractAutobuildErrors(error: string): string | undefined {
|
||||
const pattern = /.*\[autobuild\] \[ERROR\] (.*)/gi;
|
||||
return (
|
||||
[...error.matchAll(pattern)].map((match) => match[1]).join("\n") ||
|
||||
undefined
|
||||
);
|
||||
let errorLines = [...error.matchAll(pattern)].map((match) => match[1]);
|
||||
// Truncate if there are more than 10 matching lines.
|
||||
if (errorLines.length > 10) {
|
||||
errorLines = errorLines.slice(0, 10);
|
||||
errorLines.push("(truncated)");
|
||||
}
|
||||
return errorLines.join("\n") || undefined;
|
||||
}
|
||||
|
||||
function ensureEndsInPeriod(text: string): string {
|
||||
|
||||
Reference in New Issue
Block a user