Allow repository tools property fallback in resolveToolsInput

This commit is contained in:
copilot-swe-agent[bot]
2026-05-29 11:39:28 +00:00
committed by GitHub
parent aeb3e20ace
commit 9b49e27edb
2 changed files with 7 additions and 18 deletions
+5 -7
View File
@@ -114,7 +114,7 @@ test("resolveToolsInput returns undefined when repository property is undefined"
t.is(loggedMessages.length, 0);
});
test("resolveToolsInput ignores repository property when fallback is disabled", (t) => {
test("resolveToolsInput returns repository property when fallback is disabled", (t) => {
const loggedMessages: LoggedMessage[] = [];
const logger = getRecordingLogger(loggedMessages);
@@ -128,13 +128,11 @@ test("resolveToolsInput ignores repository property when fallback is disabled",
logger,
);
t.is(result, undefined);
t.is(result, "toolcache");
t.is(loggedMessages.length, 1);
const fallbackDisabledMessage = String(loggedMessages[0].message);
t.true(
/Ignoring 'github-codeql-tools' repository property because it is only supported for dynamic workflows\./.test(
fallbackDisabledMessage,
),
t.is(
loggedMessages[0].message,
"Setting tools: toolcache based on the 'github-codeql-tools' repository property.",
);
});
+2 -11
View File
@@ -10,14 +10,14 @@ import { Logger } from "../logging";
* falls back to the repository property (if set and enabled for this workflow).
*
* @param toolsWorkflowInput - The value of the `tools` workflow input, if provided.
* @param allowRepositoryPropertyFallback - Whether the repository property fallback is enabled.
* @param _allowRepositoryPropertyFallback - Reserved for backwards compatibility.
* @param repositoryProperties - The parsed repository properties.
* @param logger - Logger for outputting resolution messages.
* @returns The effective tools input value.
*/
export function resolveToolsInput(
toolsWorkflowInput: string | undefined,
allowRepositoryPropertyFallback: boolean,
_allowRepositoryPropertyFallback: boolean,
repositoryProperties: RepositoryProperties,
logger: Logger,
): string | undefined {
@@ -30,15 +30,6 @@ export function resolveToolsInput(
const toolsPropertyValue = repositoryProperties[RepositoryPropertyName.TOOLS];
if (!allowRepositoryPropertyFallback) {
if (toolsPropertyValue) {
logger.info(
`No explicit tools input was provided. Ignoring '${RepositoryPropertyName.TOOLS}' repository property because it is only supported for dynamic workflows.`,
);
}
return undefined;
}
if (toolsPropertyValue) {
logger.info(
`Setting tools: ${toolsPropertyValue} based on the '${RepositoryPropertyName.TOOLS}' repository property.`,