Skip to content

Commit 67e683b

Browse files
committed
Report bundled DB size in error if known
1 parent cb26a02 commit 67e683b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/analyze-action.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/database-upload.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ export async function cleanupAndUploadDatabases(
9595

9696
const reports: DatabaseUploadResult[] = [];
9797
for (const language of config.languages) {
98+
let bundledDbSize: number | undefined = undefined;
9899
try {
99100
// Upload the database bundle.
100101
// Although we are uploading arbitrary file contents to the API, it's worth
101102
// noting that it's the API's job to validate that the contents is acceptable.
102103
// This API method is available to anyone with write access to the repo.
103104
const bundledDb = await bundleDb(config, language, codeql, language);
104-
const bundledDbSize = fs.statSync(bundledDb).size;
105+
bundledDbSize = fs.statSync(bundledDb).size;
105106
const bundledDbReadStream = fs.createReadStream(bundledDb);
106107
const commitOid = await gitUtils.getCommitOid(
107108
actionsUtil.getRequiredInput("checkout_path"),
@@ -144,6 +145,7 @@ export async function cleanupAndUploadDatabases(
144145
reports.push({
145146
language,
146147
error: util.getErrorMessage(e),
148+
...(bundledDbSize ? { zipped_upload_size_bytes: bundledDbSize } : {}),
147149
});
148150
}
149151
}

0 commit comments

Comments
 (0)