@@ -5,6 +5,7 @@ import { performance } from "perf_hooks";
55import * as core from "@actions/core" ;
66import * as yaml from "js-yaml" ;
77
8+ import { ActionState } from "./action-common" ;
89import {
910 getActionVersion ,
1011 getOptionalInput ,
@@ -78,6 +79,7 @@ import {
7879 Success ,
7980 Failure ,
8081 isHostedRunner ,
82+ getEnv ,
8183} from "./util" ;
8284
8385/**
@@ -600,12 +602,11 @@ async function downloadCacheWithTime(
600602}
601603
602604async function loadUserConfig (
603- logger : Logger ,
605+ actionState : ActionState ,
604606 configFile : string ,
605607 workspacePath : string ,
606608 apiDetails : api . GitHubApiCombinedDetails ,
607609 tempDir : string ,
608- validateConfig : boolean ,
609610) : Promise < UserConfig > {
610611 if ( isLocal ( configFile ) ) {
611612 if ( configFile !== userConfigFromActionPath ( tempDir ) ) {
@@ -618,14 +619,12 @@ async function loadUserConfig(
618619 ) ;
619620 }
620621 }
621- return getLocalConfig ( logger , configFile , validateConfig ) ;
622- } else {
623- return await getRemoteConfig (
624- logger ,
625- configFile ,
626- apiDetails ,
627- validateConfig ,
622+ const validateConfig = await actionState . features . getValue (
623+ Feature . ValidateDbConfig ,
628624 ) ;
625+ return getLocalConfig ( actionState . logger , configFile , validateConfig ) ;
626+ } else {
627+ return await getRemoteConfig ( actionState , configFile , apiDetails ) ;
629628 }
630629}
631630
@@ -1161,14 +1160,13 @@ export async function initConfig(
11611160 logger . debug ( "No configuration file was provided" ) ;
11621161 } else {
11631162 logger . debug ( `Using configuration file: ${ inputs . configFile } ` ) ;
1164- const validateConfig = await features . getValue ( Feature . ValidateDbConfig ) ;
1163+ const actionState : ActionState = { logger , features, env : getEnv ( ) } ;
11651164 userConfig = await loadUserConfig (
1166- logger ,
1165+ actionState ,
11671166 inputs . configFile ,
11681167 inputs . workspacePath ,
11691168 inputs . apiDetails ,
11701169 tempDir ,
1171- validateConfig ,
11721170 ) ;
11731171 }
11741172
0 commit comments