Call shouldPerformDiffInformedAnalysis() outside setupDiffInformedQueryRun()

This commit is contained in:
Chuan-kai Lin 2025-03-27 10:21:05 -07:00
parent 1994ea768e
commit 3c4533916b
2 changed files with 7 additions and 14 deletions

View file

@ -22,6 +22,7 @@ import { getCodeQL } from "./codeql";
import { Config, getConfig } from "./config-utils";
import { uploadDatabases } from "./database-upload";
import { uploadDependencyCaches } from "./dependency-caching";
import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils";
import { EnvVar } from "./environment";
import { Features } from "./feature-flags";
import { Language } from "./languages";
@ -269,11 +270,14 @@ async function run() {
logger,
);
const diffRangePackDir = await setupDiffInformedQueryRun(
const branches = await shouldPerformDiffInformedAnalysis(
codeql,
logger,
features,
logger,
);
const diffRangePackDir = branches
? await setupDiffInformedQueryRun(branches, logger)
: undefined;
await warnIfGoInstalledAfterInit(config, logger);
await runAutobuildIfLegacyGoWorkflow(config, logger);

View file

@ -16,7 +16,6 @@ import { addDiagnostic, makeDiagnostic } from "./diagnostics";
import {
DiffThunkRange,
PullRequestBranches,
shouldPerformDiffInformedAnalysis,
writeDiffRangesJsonFile,
} from "./diff-informed-analysis-utils";
import { EnvVar } from "./environment";
@ -263,19 +262,9 @@ async function finalizeDatabaseCreation(
* the diff range information, or `undefined` if the feature is disabled.
*/
export async function setupDiffInformedQueryRun(
codeql: CodeQL,
branches: PullRequestBranches,
logger: Logger,
features: FeatureEnablement,
): Promise<string | undefined> {
const branches = await shouldPerformDiffInformedAnalysis(
codeql,
features,
logger,
);
if (!branches) {
return undefined;
}
return await withGroupAsync(
"Generating diff range extension pack",
async () => {