Skip to content

Commit fcd4657

Browse files
committed
Compute InitConfigInputs early
1 parent 9ebca4c commit fcd4657

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

src/init-action.ts

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,39 @@ async function run() {
233233
if (statusReportBase !== undefined) {
234234
await sendStatusReport(statusReportBase);
235235
}
236+
237+
const inputs: configUtils.InitConfigInputs = {
238+
analysisKindsInput: getRequiredInput("analysis-kinds"),
239+
languagesInput: getOptionalInput("languages"),
240+
queriesInput: getOptionalInput("queries"),
241+
qualityQueriesInput: getOptionalInput("quality-queries"),
242+
packsInput: getOptionalInput("packs"),
243+
buildModeInput: getOptionalInput("build-mode"),
244+
configFile,
245+
dbLocation: getOptionalInput("db-location"),
246+
configInput: getOptionalInput("config"),
247+
trapCachingEnabled: getTrapCachingEnabled(),
248+
dependencyCachingEnabled: getDependencyCachingEnabled(),
249+
// Debug mode is enabled if:
250+
// - The `init` Action is passed `debug: true`.
251+
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
252+
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
253+
debugMode: getOptionalInput("debug") === "true" || core.isDebug(),
254+
debugArtifactName:
255+
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
256+
debugDatabaseName:
257+
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
258+
repository: repositoryNwo,
259+
tempDir: getTemporaryDirectory(),
260+
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
261+
sourceRoot,
262+
githubVersion: gitHubVersion,
263+
apiDetails,
264+
features,
265+
repositoryProperties,
266+
logger,
267+
};
268+
236269
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
237270
gitHubVersion.type,
238271
);
@@ -288,51 +321,14 @@ async function run() {
288321
}
289322

290323
// Warn that `quality-queries` is deprecated if there is an argument for it.
291-
const qualityQueriesInput = getOptionalInput("quality-queries");
292-
293-
if (qualityQueriesInput !== undefined) {
324+
if (inputs.qualityQueriesInput !== undefined) {
294325
logger.warning(
295326
"The `quality-queries` input is deprecated and will be removed in a future version of the CodeQL Action. " +
296327
"Use the `analysis-kinds` input to configure different analysis kinds instead.",
297328
);
298329
}
299330

300-
config = await initConfig(
301-
{
302-
analysisKindsInput: getRequiredInput("analysis-kinds"),
303-
languagesInput: getOptionalInput("languages"),
304-
queriesInput: getOptionalInput("queries"),
305-
qualityQueriesInput,
306-
packsInput: getOptionalInput("packs"),
307-
buildModeInput: getOptionalInput("build-mode"),
308-
configFile,
309-
dbLocation: getOptionalInput("db-location"),
310-
configInput: getOptionalInput("config"),
311-
trapCachingEnabled: getTrapCachingEnabled(),
312-
dependencyCachingEnabled: getDependencyCachingEnabled(),
313-
// Debug mode is enabled if:
314-
// - The `init` Action is passed `debug: true`.
315-
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
316-
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
317-
debugMode: getOptionalInput("debug") === "true" || core.isDebug(),
318-
debugArtifactName:
319-
getOptionalInput("debug-artifact-name") ||
320-
DEFAULT_DEBUG_ARTIFACT_NAME,
321-
debugDatabaseName:
322-
getOptionalInput("debug-database-name") ||
323-
DEFAULT_DEBUG_DATABASE_NAME,
324-
repository: repositoryNwo,
325-
tempDir: getTemporaryDirectory(),
326-
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
327-
sourceRoot,
328-
githubVersion: gitHubVersion,
329-
apiDetails,
330-
features,
331-
repositoryProperties,
332-
logger,
333-
},
334-
codeql,
335-
);
331+
config = await initConfig(inputs, codeql);
336332

337333
await checkInstallPython311(config.languages, codeql);
338334
} catch (unwrappedError) {

0 commit comments

Comments
 (0)