mirror of
https://github.com/github/codeql-action.git
synced 2025-12-22 15:20:19 +08:00
Truncate autobuild errors to 10 lines
This commit is contained in:
9
lib/cli-errors.js
generated
9
lib/cli-errors.js
generated
@@ -103,8 +103,13 @@ function extractFatalErrors(error) {
|
||||
}
|
||||
function extractAutobuildErrors(error) {
|
||||
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) {
|
||||
return text[text.length - 1] === "." ? text : `${text}.`;
|
||||
|
||||
Reference in New Issue
Block a user