mirror of
https://github.com/github/codeql-action.git
synced 2025-12-21 14:50:08 +08:00
Clean up the database if it will be uploaded
This commit is contained in:
10
lib/database-upload.js
generated
10
lib/database-upload.js
generated
@@ -37,11 +37,11 @@ exports.uploadDatabases = uploadDatabases;
|
||||
const fs = __importStar(require("fs"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const gitUtils = __importStar(require("./git-utils"));
|
||||
const logging_1 = require("./logging");
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
async function uploadDatabases(repositoryNwo, codeql, config, apiDetails, logger) {
|
||||
if (actionsUtil.getRequiredInput("upload-database") !== "true") {
|
||||
logger.debug("Database upload disabled in workflow. Skipping upload.");
|
||||
return;
|
||||
@@ -61,8 +61,12 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
logger.debug("Not analyzing default branch. Skipping upload.");
|
||||
return;
|
||||
}
|
||||
// Clean up the database, since intermediate results may still be written to the
|
||||
// database if there is high RAM pressure.
|
||||
await (0, logging_1.withGroupAsync)("Cleaning up databases", async () => {
|
||||
await codeql.databaseCleanupCluster(config, "clear");
|
||||
});
|
||||
const client = (0, api_client_1.getApiClient)();
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
const uploadsUrl = new URL((0, util_1.parseGitHubUrl)(apiDetails.url));
|
||||
uploadsUrl.hostname = `uploads.${uploadsUrl.hostname}`;
|
||||
// Octokit expects the baseUrl to not have a trailing slash,
|
||||
|
||||
Reference in New Issue
Block a user