@@ -588,23 +588,12 @@ async function loadConfig({
588
588
features,
589
589
logger,
590
590
} : LoadConfigInputs ) : Promise < Config > {
591
- let parsedYAML : UserConfig ;
592
-
593
- if ( isLocal ( configFile ) ) {
594
- if ( configFile !== userConfigFromActionPath ( tempDir ) ) {
595
- // If the config file is not generated by the Action, it should be relative to the workspace.
596
- configFile = path . resolve ( workspacePath , configFile ) ;
597
- // Error if the config file is now outside of the workspace
598
- if ( ! ( configFile + path . sep ) . startsWith ( workspacePath + path . sep ) ) {
599
- throw new ConfigurationError (
600
- getConfigFileOutsideWorkspaceErrorMessage ( configFile ) ,
601
- ) ;
602
- }
603
- }
604
- parsedYAML = getLocalConfig ( configFile ) ;
605
- } else {
606
- parsedYAML = await getRemoteConfig ( configFile , apiDetails ) ;
607
- }
591
+ const parsedYAML = await loadUserConfig (
592
+ configFile ,
593
+ workspacePath ,
594
+ apiDetails ,
595
+ tempDir ,
596
+ ) ;
608
597
609
598
const languages = await getLanguages (
610
599
codeql ,
@@ -658,6 +647,29 @@ async function loadConfig({
658
647
} ;
659
648
}
660
649
650
+ async function loadUserConfig (
651
+ configFile : string ,
652
+ workspacePath : string ,
653
+ apiDetails : api . GitHubApiCombinedDetails ,
654
+ tempDir : string ,
655
+ ) : Promise < UserConfig > {
656
+ if ( isLocal ( configFile ) ) {
657
+ if ( configFile !== userConfigFromActionPath ( tempDir ) ) {
658
+ // If the config file is not generated by the Action, it should be relative to the workspace.
659
+ configFile = path . resolve ( workspacePath , configFile ) ;
660
+ // Error if the config file is now outside of the workspace
661
+ if ( ! ( configFile + path . sep ) . startsWith ( workspacePath + path . sep ) ) {
662
+ throw new ConfigurationError (
663
+ getConfigFileOutsideWorkspaceErrorMessage ( configFile ) ,
664
+ ) ;
665
+ }
666
+ }
667
+ return getLocalConfig ( configFile ) ;
668
+ } else {
669
+ return await getRemoteConfig ( configFile , apiDetails ) ;
670
+ }
671
+ }
672
+
661
673
/**
662
674
* Calculates how the codeql config file needs to be augmented before passing
663
675
* it to the CLI. The reason this is necessary is the codeql-action can be called
0 commit comments