Skip to content

Commit 9b49e27

Browse files
authored
Allow repository tools property fallback in resolveToolsInput
1 parent aeb3e20 commit 9b49e27

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

src/config/resolve-tools-input.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ test("resolveToolsInput returns undefined when repository property is undefined"
114114
t.is(loggedMessages.length, 0);
115115
});
116116

117-
test("resolveToolsInput ignores repository property when fallback is disabled", (t) => {
117+
test("resolveToolsInput returns repository property when fallback is disabled", (t) => {
118118
const loggedMessages: LoggedMessage[] = [];
119119
const logger = getRecordingLogger(loggedMessages);
120120

@@ -128,13 +128,11 @@ test("resolveToolsInput ignores repository property when fallback is disabled",
128128
logger,
129129
);
130130

131-
t.is(result, undefined);
131+
t.is(result, "toolcache");
132132
t.is(loggedMessages.length, 1);
133-
const fallbackDisabledMessage = String(loggedMessages[0].message);
134-
t.true(
135-
/Ignoring 'github-codeql-tools' repository property because it is only supported for dynamic workflows\./.test(
136-
fallbackDisabledMessage,
137-
),
133+
t.is(
134+
loggedMessages[0].message,
135+
"Setting tools: toolcache based on the 'github-codeql-tools' repository property.",
138136
);
139137
});
140138

src/config/resolve-tools-input.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { Logger } from "../logging";
1010
* falls back to the repository property (if set and enabled for this workflow).
1111
*
1212
* @param toolsWorkflowInput - The value of the `tools` workflow input, if provided.
13-
* @param allowRepositoryPropertyFallback - Whether the repository property fallback is enabled.
13+
* @param _allowRepositoryPropertyFallback - Reserved for backwards compatibility.
1414
* @param repositoryProperties - The parsed repository properties.
1515
* @param logger - Logger for outputting resolution messages.
1616
* @returns The effective tools input value.
1717
*/
1818
export function resolveToolsInput(
1919
toolsWorkflowInput: string | undefined,
20-
allowRepositoryPropertyFallback: boolean,
20+
_allowRepositoryPropertyFallback: boolean,
2121
repositoryProperties: RepositoryProperties,
2222
logger: Logger,
2323
): string | undefined {
@@ -30,15 +30,6 @@ export function resolveToolsInput(
3030

3131
const toolsPropertyValue = repositoryProperties[RepositoryPropertyName.TOOLS];
3232

33-
if (!allowRepositoryPropertyFallback) {
34-
if (toolsPropertyValue) {
35-
logger.info(
36-
`No explicit tools input was provided. Ignoring '${RepositoryPropertyName.TOOLS}' repository property because it is only supported for dynamic workflows.`,
37-
);
38-
}
39-
return undefined;
40-
}
41-
4233
if (toolsPropertyValue) {
4334
logger.info(
4435
`Setting tools: ${toolsPropertyValue} based on the '${RepositoryPropertyName.TOOLS}' repository property.`,

0 commit comments

Comments
 (0)