Skip to content

Commit 0025d0f

Browse files
committed
Use FF
1 parent f7fa18f commit 0025d0f

4 files changed

Lines changed: 49 additions & 9 deletions

File tree

lib/entry-points.js

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config/file.test.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ setupTests(test);
1515
test("getConfigFileInput returns undefined by default", async (t) => {
1616
const logger = new RecordingLogger();
1717
const actionsEnv = getTestActionsEnv();
18-
const result = getConfigFileInput(logger, actionsEnv, {});
18+
const result = getConfigFileInput(logger, actionsEnv, {}, true);
1919
t.is(result, undefined);
2020
});
2121

@@ -34,7 +34,12 @@ test("getConfigFileInput returns input value", async (t) => {
3434

3535
// Even though both an input and repository property are configured,
3636
// we prefer the direct input to the Action.
37-
const result = getConfigFileInput(logger, actionsEnv, repositoryProperties);
37+
const result = getConfigFileInput(
38+
logger,
39+
actionsEnv,
40+
repositoryProperties,
41+
true,
42+
);
3843
t.is(result, testInput);
3944

4045
// Check for the expected log message.
@@ -46,7 +51,12 @@ test("getConfigFileInput returns repository property value", async (t) => {
4651
const actionsEnv = getTestActionsEnv();
4752

4853
// Since there is no direct input, we should use the repository property.
49-
const result = getConfigFileInput(logger, actionsEnv, repositoryProperties);
54+
const result = getConfigFileInput(
55+
logger,
56+
actionsEnv,
57+
repositoryProperties,
58+
true,
59+
);
5060
t.is(result, repositoryProperties[RepositoryPropertyName.CONFIG_FILE]);
5161

5262
// Check for the expected log message.
@@ -62,8 +72,13 @@ test("getConfigFileInput ignores empty repository property value", async (t) =>
6272
const actionsEnv = getTestActionsEnv();
6373

6474
// Since the repository property value is an empty/whitespace string, we should ignore it.
65-
const result = getConfigFileInput(logger, actionsEnv, {
66-
[RepositoryPropertyName.CONFIG_FILE]: " ",
67-
});
75+
const result = getConfigFileInput(
76+
logger,
77+
actionsEnv,
78+
{
79+
[RepositoryPropertyName.CONFIG_FILE]: " ",
80+
},
81+
true,
82+
);
6883
t.is(result, undefined);
6984
});

src/config/file.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function getConfigFileInput(
1212
logger: Logger,
1313
actions: ActionsEnv,
1414
repositoryProperties: Partial<RepositoryProperties>,
15+
useRepositoryProperty: boolean,
1516
): string | undefined {
1617
const input = actions.getOptionalInput("config-file");
1718

@@ -20,6 +21,11 @@ export function getConfigFileInput(
2021
return input;
2122
}
2223

24+
// Don't take the repository property into consideration if the FF is not enabled.
25+
if (!useRepositoryProperty) {
26+
return undefined;
27+
}
28+
2329
const propertyValue =
2430
repositoryProperties[RepositoryPropertyName.CONFIG_FILE];
2531

src/init-action.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,15 @@ async function run(startedAt: Date) {
263263

264264
core.exportVariable(EnvVar.INIT_ACTION_HAS_RUN, "true");
265265

266-
configFile = getConfigFileInput(logger, actionsEnv, repositoryProperties);
266+
const useConfigFileProperty = await features.getValue(
267+
Feature.ConfigFileRepositoryProperty,
268+
);
269+
configFile = getConfigFileInput(
270+
logger,
271+
actionsEnv,
272+
repositoryProperties,
273+
useConfigFileProperty,
274+
);
267275

268276
// path.resolve() respects the intended semantics of source-root. If
269277
// source-root is relative, it is relative to the GITHUB_WORKSPACE. If

0 commit comments

Comments
 (0)