Refactor setupDiffInformedQueryRun querying checkout_path itself

This commit is contained in:
Michael B. Gale
2026-09-16 12:35:13 +01:00
parent 669351e880
commit 3a30b151d6
3 changed files with 24 additions and 10 deletions

16
lib/entry-points.js generated
View File

@@ -153887,7 +153887,7 @@ async function finalizeDatabaseCreation(codeql, features, config, threadsFlag, m
trap_import_duration_ms: Math.round(trapImportTime)
};
}
async function setupDiffInformedQueryRun(logger) {
async function setupDiffInformedQueryRun(logger, checkoutPath) {
return await withGroupAsync(
"Generating diff range extension pack",
async () => {
@@ -153898,7 +153898,6 @@ async function setupDiffInformedQueryRun(logger) {
);
return void 0;
}
const checkoutPath = getRequiredInput("checkout_path");
const packDir = writeDiffRangeDataExtensionPack(
logger,
diffRanges,
@@ -156547,7 +156546,11 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
);
await runAutobuild(config, "go" /* go */, logger);
}
async function run({ startedAt, logger }) {
async function run({
startedAt,
logger,
actions
}) {
let uploadResults = void 0;
let runStats = void 0;
let config = void 0;
@@ -156613,7 +156616,11 @@ async function run({ startedAt, logger }) {
getOptionalInput("ram") || process.env["CODEQL_RAM"],
logger
);
const diffRangePackDir = await setupDiffInformedQueryRun(logger);
const checkoutPath = actions.getRequiredInput("checkout_path");
const diffRangePackDir = await setupDiffInformedQueryRun(
logger,
checkoutPath
);
await warnIfGoInstalledAfterInit(config, logger);
await runAutobuildIfLegacyGoWorkflow(config, logger);
dbCreationTimings = await runFinalize(
@@ -156653,7 +156660,6 @@ async function run({ startedAt, logger }) {
getOptionalInput("upload")
);
if (runStats) {
const checkoutPath = getRequiredInput("checkout_path");
const category = getOptionalInput("category");
uploadResults = await postProcessAndUploadSarif(
logger,

View File

@@ -212,7 +212,11 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
await runAutobuild(config, BuiltInLanguage.go, logger);
}
async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
async function run({
startedAt,
logger,
actions,
}: ActionState<["Base", "Logger", "Actions"]>) {
// To capture errors appropriately, keep as much code within the try-catch as
// possible, and only use safe functions outside.
@@ -307,8 +311,13 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
logger,
);
const checkoutPath = actions.getRequiredInput("checkout_path");
// Setup diff informed analysis if needed (based on whether init created the file)
const diffRangePackDir = await setupDiffInformedQueryRun(logger);
const diffRangePackDir = await setupDiffInformedQueryRun(
logger,
checkoutPath,
);
await warnIfGoInstalledAfterInit(config, logger);
await runAutobuildIfLegacyGoWorkflow(config, logger);
@@ -354,7 +363,6 @@ async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) {
actionsUtil.getOptionalInput("upload"),
);
if (runStats) {
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
const category = actionsUtil.getOptionalInput("category");
uploadResults = await postProcessAndUploadSarif(

View File

@@ -5,7 +5,7 @@ import { performance } from "perf_hooks";
import * as io from "@actions/io";
import * as yaml from "js-yaml";
import { getTemporaryDirectory, getRequiredInput } from "./actions-util";
import { getTemporaryDirectory } from "./actions-util";
import * as analyses from "./analyses";
import { setupCppAutobuild } from "./autobuild";
import { type CodeQL } from "./codeql";
@@ -233,6 +233,7 @@ async function finalizeDatabaseCreation(
*/
export async function setupDiffInformedQueryRun(
logger: Logger,
checkoutPath: string,
): Promise<string | undefined> {
return await withGroupAsync(
"Generating diff range extension pack",
@@ -245,7 +246,6 @@ export async function setupDiffInformedQueryRun(
return undefined;
}
const checkoutPath = getRequiredInput("checkout_path");
const packDir = writeDiffRangeDataExtensionPack(
logger,
diffRanges,