Analyze: Log the analysis summary in its own group

Fix grouping of the analysis logs, so that custom query logs also get grouped.
Capture the stdout of codeql database analyze, which contains the analysis summary
from summary and diagnostic queries.
Log this output in its own group, along with the baseline computed in the Action.
This commit is contained in:
Aditya Sharad 2021-05-19 16:01:06 -07:00
parent 6a9815718a
commit 19fe63f821
No known key found for this signature in database
GPG key ID: 66D1E528054C320C
10 changed files with 51 additions and 20 deletions

View file

@ -96,7 +96,7 @@ export interface CodeQL {
addSnippetsFlag: string,
threadsFlag: string,
automationDetailsId: string | undefined
): Promise<void>;
): Promise<string>;
}
export interface ResolveQueriesOutput {
@ -688,7 +688,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
addSnippetsFlag: string,
threadsFlag: string,
automationDetailsId: string | undefined
) {
): Promise<string> {
const args = [
"database",
"analyze",
@ -712,7 +712,16 @@ function getCodeQLForCmd(cmd: string): CodeQL {
args.push("--sarif-category", automationDetailsId);
}
args.push(querySuite);
await new toolrunner.ToolRunner(cmd, args).exec();
// capture stdout, which contains analysis summaries
let output = "";
await new toolrunner.ToolRunner(cmd, args, {
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
},
},
}).exec();
return output;
},
};
}