mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 09:40:17 +08:00
Extract logging statements to separate function
This commit is contained in:
@@ -240,15 +240,7 @@ export async function runQueries(
|
||||
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
if (await util.useCodeScanningConfigInCli(codeql, featureFlags)) {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql-action."
|
||||
);
|
||||
} else {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql CLI."
|
||||
);
|
||||
}
|
||||
await util.logCodeScanningConfigInCli(codeql, featureFlags, logger);
|
||||
|
||||
for (const language of config.languages) {
|
||||
const queries = config.queries[language];
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
codeQlVersionAbove,
|
||||
getMlPoweredJsQueriesPack,
|
||||
GitHubVersion,
|
||||
logCodeScanningConfigInCli,
|
||||
ML_POWERED_JS_QUERIES_PACK_NAME,
|
||||
useCodeScanningConfigInCli,
|
||||
} from "./util";
|
||||
@@ -1704,10 +1705,9 @@ export async function initConfig(
|
||||
// When using the codescanning config in the CLI, pack downloads
|
||||
// happen in the CLI during the `database init` command, so no need
|
||||
// to download them here.
|
||||
await logCodeScanningConfigInCli(codeQL, featureFlags, logger);
|
||||
|
||||
if (!(await useCodeScanningConfigInCli(codeQL, featureFlags))) {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql CLI."
|
||||
);
|
||||
const registries = parseRegistries(registriesInput);
|
||||
await downloadPacks(
|
||||
codeQL,
|
||||
@@ -1718,10 +1718,6 @@ export async function initConfig(
|
||||
config.tempDir,
|
||||
logger
|
||||
);
|
||||
} else {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql-action."
|
||||
);
|
||||
}
|
||||
|
||||
// Save the config so we can easily access it again in the future
|
||||
|
||||
16
src/util.ts
16
src/util.ts
@@ -817,6 +817,22 @@ export async function useCodeScanningConfigInCli(
|
||||
return await codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES);
|
||||
}
|
||||
|
||||
export async function logCodeScanningConfigInCli(
|
||||
codeql: CodeQL,
|
||||
featureFlags: FeatureFlags,
|
||||
logger: Logger
|
||||
) {
|
||||
if (await useCodeScanningConfigInCli(codeql, featureFlags)) {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql CLI."
|
||||
);
|
||||
} else {
|
||||
logger.info(
|
||||
"Code Scanning configuration file being processed in the codeql-action."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the path in the argument represents an existing directory.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user