mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
log some stats about the upload
This commit is contained in:
13
lib/upload-lib.js
generated
13
lib/upload-lib.js
generated
@@ -125,6 +125,15 @@ async function upload(input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.upload = upload;
|
exports.upload = upload;
|
||||||
|
// Counts the number of results in the given SARIF file
|
||||||
|
function countResultsInSarif(sarif) {
|
||||||
|
let numResults = 0;
|
||||||
|
for (const run of JSON.parse(sarif).runs) {
|
||||||
|
numResults += run.results.length;
|
||||||
|
}
|
||||||
|
return numResults;
|
||||||
|
}
|
||||||
|
exports.countResultsInSarif = countResultsInSarif;
|
||||||
// Uploads the given set of sarif files.
|
// Uploads the given set of sarif files.
|
||||||
// Returns true iff the upload occurred and succeeded
|
// Returns true iff the upload occurred and succeeded
|
||||||
async function uploadFiles(sarifFiles) {
|
async function uploadFiles(sarifFiles) {
|
||||||
@@ -173,6 +182,10 @@ async function uploadFiles(sarifFiles) {
|
|||||||
"started_at": startedAt,
|
"started_at": startedAt,
|
||||||
"tool_names": toolNames,
|
"tool_names": toolNames,
|
||||||
});
|
});
|
||||||
|
// Log some useful debug info about the info
|
||||||
|
core.debug("Raw upload size: " + sarifPayload.length + " bytes");
|
||||||
|
core.debug("Base64 zipped upload size: " + zipped_sarif.length + " bytes");
|
||||||
|
core.debug("Number of results in upload: " + countResultsInSarif(sarifPayload));
|
||||||
// Make the upload
|
// Make the upload
|
||||||
succeeded = await uploadPayload(payload);
|
succeeded = await uploadPayload(payload);
|
||||||
// Mark that we have made an upload
|
// Mark that we have made an upload
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -128,6 +128,15 @@ export async function upload(input: string): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Counts the number of results in the given SARIF file
|
||||||
|
export function countResultsInSarif(sarif: string): number {
|
||||||
|
let numResults = 0;
|
||||||
|
for (const run of JSON.parse(sarif).runs) {
|
||||||
|
numResults += run.results.length;
|
||||||
|
}
|
||||||
|
return numResults;
|
||||||
|
}
|
||||||
|
|
||||||
// Uploads the given set of sarif files.
|
// Uploads the given set of sarif files.
|
||||||
// Returns true iff the upload occurred and succeeded
|
// Returns true iff the upload occurred and succeeded
|
||||||
async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
|
async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
|
||||||
@@ -184,6 +193,11 @@ async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
|
|||||||
"tool_names": toolNames,
|
"tool_names": toolNames,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Log some useful debug info about the info
|
||||||
|
core.debug("Raw upload size: " + sarifPayload.length + " bytes");
|
||||||
|
core.debug("Base64 zipped upload size: " + zipped_sarif.length + " bytes");
|
||||||
|
core.debug("Number of results in upload: " + countResultsInSarif(sarifPayload));
|
||||||
|
|
||||||
// Make the upload
|
// Make the upload
|
||||||
succeeded = await uploadPayload(payload);
|
succeeded = await uploadPayload(payload);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user