@@ -593,12 +593,24 @@ export function amendInputConfigFile(
593593 }
594594}
595595
596+ /**
597+ * Load user configuration from a file or return an empty configuration
598+ * if no config file is specified.
599+ */
596600async function loadUserConfig (
597- configFile : string ,
601+ configFile : string | undefined ,
598602 workspacePath : string ,
599603 apiDetails : api . GitHubApiCombinedDetails ,
600604 tempDir : string ,
605+ logger : Logger ,
601606) : Promise < UserConfig > {
607+ if ( ! configFile ) {
608+ logger . debug ( "No configuration file was provided" ) ;
609+ return { } ;
610+ }
611+
612+ logger . debug ( `Using configuration file: ${ configFile } ` ) ;
613+
602614 if ( isLocal ( configFile ) ) {
603615 if ( configFile !== userConfigFromActionPath ( tempDir ) ) {
604616 // 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(
863875) : Promise < Config > {
864876 const { logger, tempDir } = inputs ;
865877
866- let userConfig : UserConfig = { } ;
867- if ( ! inputs . configFile ) {
868- logger . debug ( "No configuration file was provided" ) ;
869- } else {
870- logger . debug ( `Using configuration file: ${ inputs . configFile } ` ) ;
871- userConfig = await loadUserConfig (
872- inputs . configFile ,
873- inputs . workspacePath ,
874- inputs . apiDetails ,
875- tempDir ,
876- ) ;
877- }
878-
878+ const userConfig = await loadUserConfig (
879+ inputs . configFile ,
880+ inputs . workspacePath ,
881+ inputs . apiDetails ,
882+ tempDir ,
883+ logger ,
884+ ) ;
879885 const config = await initActionState ( inputs , userConfig , codeql ) ;
880886
881887 // If Code Quality analysis is the only enabled analysis kind, then we will initialise
0 commit comments