mirror of
https://github.com/github/codeql-action.git
synced 2026-05-27 08:55:05 +00:00
Move support code into loadUserConfig()
This commit is contained in:
+20
-14
@@ -593,12 +593,24 @@ export function amendInputConfigFile(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load user configuration from a file or return an empty configuration
|
||||
* if no config file is specified.
|
||||
*/
|
||||
async function loadUserConfig(
|
||||
configFile: string,
|
||||
configFile: string | undefined,
|
||||
workspacePath: string,
|
||||
apiDetails: api.GitHubApiCombinedDetails,
|
||||
tempDir: string,
|
||||
logger: Logger,
|
||||
): Promise<UserConfig> {
|
||||
if (!configFile) {
|
||||
logger.debug("No configuration file was provided");
|
||||
return {};
|
||||
}
|
||||
|
||||
logger.debug(`Using configuration file: ${configFile}`);
|
||||
|
||||
if (isLocal(configFile)) {
|
||||
if (configFile !== userConfigFromActionPath(tempDir)) {
|
||||
// If the config file is not generated by the Action, it should be relative to the workspace.
|
||||
@@ -863,19 +875,13 @@ export async function initConfig(
|
||||
): Promise<Config> {
|
||||
const { logger, tempDir } = inputs;
|
||||
|
||||
let userConfig: UserConfig = {};
|
||||
if (!inputs.configFile) {
|
||||
logger.debug("No configuration file was provided");
|
||||
} else {
|
||||
logger.debug(`Using configuration file: ${inputs.configFile}`);
|
||||
userConfig = await loadUserConfig(
|
||||
inputs.configFile,
|
||||
inputs.workspacePath,
|
||||
inputs.apiDetails,
|
||||
tempDir,
|
||||
);
|
||||
}
|
||||
|
||||
const userConfig = await loadUserConfig(
|
||||
inputs.configFile,
|
||||
inputs.workspacePath,
|
||||
inputs.apiDetails,
|
||||
tempDir,
|
||||
logger,
|
||||
);
|
||||
const config = await initActionState(inputs, userConfig, codeql);
|
||||
|
||||
// If Code Quality analysis is the only enabled analysis kind, then we will initialise
|
||||
|
||||
Reference in New Issue
Block a user