mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Refactor cleanupAndUploadOverlayBaseDatabaseToCache querying checkout_path itself
This commit is contained in:
10
lib/entry-points.js
generated
10
lib/entry-points.js
generated
@@ -151255,7 +151255,7 @@ async function checkOverlayBaseDatabase(codeql, config, logger, warningPrefix) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger) {
|
||||
async function cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger, checkoutPath) {
|
||||
const overlayDatabaseMode = config.overlayDatabaseMode;
|
||||
if (overlayDatabaseMode !== "overlay-base" /* OverlayBase */) {
|
||||
logger.debug(
|
||||
@@ -151303,7 +151303,6 @@ async function cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger
|
||||
return false;
|
||||
}
|
||||
const codeQlVersion = (await codeql.getVersion()).version;
|
||||
const checkoutPath = getRequiredInput("checkout_path");
|
||||
const cacheSaveKey = await getCacheSaveKey(
|
||||
config,
|
||||
codeQlVersion,
|
||||
@@ -156685,7 +156684,12 @@ async function run({
|
||||
} else {
|
||||
logger.info("Not uploading results");
|
||||
}
|
||||
await cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger);
|
||||
await cleanupAndUploadOverlayBaseDatabaseToCache(
|
||||
codeql,
|
||||
config,
|
||||
logger,
|
||||
checkoutPath
|
||||
);
|
||||
databaseUploadResults = await cleanupAndUploadDatabases(
|
||||
repositoryNwo,
|
||||
codeql,
|
||||
|
||||
@@ -396,7 +396,12 @@ async function run({
|
||||
// Possibly upload the overlay-base database to actions cache.
|
||||
// Note: Take care with the ordering of this call since databases may be cleaned up
|
||||
// at the `overlay` level.
|
||||
await cleanupAndUploadOverlayBaseDatabaseToCache(codeql, config, logger);
|
||||
await cleanupAndUploadOverlayBaseDatabaseToCache(
|
||||
codeql,
|
||||
config,
|
||||
logger,
|
||||
checkoutPath,
|
||||
);
|
||||
|
||||
// Possibly upload the database bundles for remote queries.
|
||||
// Note: Take care with the ordering of this call since databases may be cleaned up
|
||||
|
||||
@@ -3,11 +3,7 @@ import * as fs from "fs";
|
||||
import * as actionsCache from "@actions/cache";
|
||||
import * as semver from "semver";
|
||||
|
||||
import {
|
||||
getRequiredInput,
|
||||
getWorkflowRunAttempt,
|
||||
getWorkflowRunID,
|
||||
} from "../actions-util";
|
||||
import { getWorkflowRunAttempt, getWorkflowRunID } from "../actions-util";
|
||||
import { getAutomationID, listActionsCaches } from "../api-client";
|
||||
import { createCacheKeyHash } from "../caching-utils";
|
||||
import { type CodeQL } from "../codeql";
|
||||
@@ -107,12 +103,13 @@ async function checkOverlayBaseDatabase(
|
||||
* Uploads the overlay-base database to the GitHub Actions cache. If conditions
|
||||
* for uploading are not met, the function does nothing and returns false.
|
||||
*
|
||||
* This function uses the `checkout_path` input to determine the repository path
|
||||
* This function uses the `checkoutPath` to determine the repository path
|
||||
* and works only when called from `analyze` or `upload-sarif`.
|
||||
*
|
||||
* @param codeql The CodeQL instance
|
||||
* @param config The configuration object
|
||||
* @param logger The logger instance
|
||||
* @param checkoutPath The path at which the repository is checked out at.
|
||||
* @returns A promise that resolves to true if the upload was performed and
|
||||
* successfully completed, or false otherwise
|
||||
*/
|
||||
@@ -120,6 +117,7 @@ export async function cleanupAndUploadOverlayBaseDatabaseToCache(
|
||||
codeql: CodeQL,
|
||||
config: Config,
|
||||
logger: Logger,
|
||||
checkoutPath: string,
|
||||
): Promise<boolean> {
|
||||
const overlayDatabaseMode = config.overlayDatabaseMode;
|
||||
if (overlayDatabaseMode !== OverlayDatabaseMode.OverlayBase) {
|
||||
@@ -180,7 +178,6 @@ export async function cleanupAndUploadOverlayBaseDatabaseToCache(
|
||||
}
|
||||
|
||||
const codeQlVersion = (await codeql.getVersion()).version;
|
||||
const checkoutPath = getRequiredInput("checkout_path");
|
||||
const cacheSaveKey = await getCacheSaveKey(
|
||||
config,
|
||||
codeQlVersion,
|
||||
|
||||
Reference in New Issue
Block a user