99import { ConfigurationError } from "../util" ;
1010
1111import { parseUserConfig , UserConfig } from "./db-config" ;
12- import { InputSource , type ComputedInput } from "./inputs" ;
12+ import { getComputedInput , InputName , type ComputedInput } from "./inputs" ;
1313import { parseRemoteFileAddress } from "./remote-file" ;
1414
1515/**
@@ -29,42 +29,19 @@ export const REMOTE_PATH_PREFIX = "remote=";
2929 * Gets the value that is configured for the configuration file, if any.
3030 */
3131export async function getConfigFileInput (
32- {
33- logger,
34- actions,
35- features,
36- } : ActionState < [ "Logger" , "Actions" , "FeatureFlags" ] > ,
32+ action : ActionState < [ "Logger" , "Actions" , "FeatureFlags" ] > ,
3733 repositoryProperties : Partial < RepositoryProperties > ,
3834) : Promise < ComputedInput | undefined > {
39- const input = actions . getOptionalInput ( "config-file" ) ;
40-
41- if ( input !== undefined ) {
42- logger . info ( `Using configuration file input from workflow: ${ input } ` ) ;
43- return { value : input , source : InputSource . Workflow } ;
44- }
45-
46- const propertyValue =
47- repositoryProperties [ RepositoryPropertyName . CONFIG_FILE ] ;
48-
49- if ( propertyValue !== undefined && propertyValue . trim ( ) . length > 0 ) {
50- // Only use the repository property value if the FF is enabled.
51- const useRepositoryProperty = await features . getValue (
52- Feature . ConfigFileRepositoryProperty ,
53- ) ;
54-
55- if ( useRepositoryProperty ) {
56- logger . info (
57- `Using configuration file input from repository property: ${ propertyValue } ` ,
58- ) ;
59- return { value : propertyValue , source : InputSource . RepositoryProperty } ;
60- } else {
61- logger . info (
62- "Ignoring configuration file input from repository property, because the corresponding feature flag is disabled." ,
63- ) ;
64- }
65- }
35+ // Only use the repository property value if the FF is enabled.
36+ const useRepositoryProperty = await action . features . getValue (
37+ Feature . ConfigFileRepositoryProperty ,
38+ ) ;
6639
67- return undefined ;
40+ return getComputedInput ( action , repositoryProperties , InputName . ConfigFile , {
41+ repositoryPropertyFeatureEnabled : useRepositoryProperty ,
42+ allowForcedRepositoryPropertyValue : false ,
43+ repositoryPropertyName : RepositoryPropertyName . CONFIG_FILE ,
44+ } ) ;
6845}
6946
7047/**
0 commit comments