Log when repository property has a value but is ignored

This commit is contained in:
Michael B. Gale
2026-07-01 16:22:48 +01:00
parent f27f56386a
commit d5f0145480
3 changed files with 26 additions and 16 deletions

17
lib/entry-points.js generated
View File

@@ -159658,15 +159658,18 @@ function getConfigFileInput(logger, actions, repositoryProperties, useRepository
logger.info(`Using configuration file input from workflow: ${input}`);
return input;
}
if (!useRepositoryProperty) {
return void 0;
}
const propertyValue = repositoryProperties["github-codeql-config-file" /* CONFIG_FILE */];
if (propertyValue !== void 0 && propertyValue.trim().length > 0) {
logger.info(
`Using configuration file input from repository property: ${propertyValue}`
);
return propertyValue;
if (useRepositoryProperty) {
logger.info(
`Using configuration file input from repository property: ${propertyValue}`
);
return propertyValue;
} else {
logger.info(
"Ignoring configuration file input from repository property, because the corresponding feature flag is disabled."
);
}
}
return void 0;
}

View File

@@ -101,4 +101,9 @@ test("getConfigFileInput ignores repository property value when FF is off", asyn
"Using configuration file input from repository property",
),
);
t.true(
logger.hasMessage(
"Ignoring configuration file input from repository property, because the corresponding feature flag is disabled.",
),
);
});

View File

@@ -21,19 +21,21 @@ export function getConfigFileInput(
return input;
}
// Don't take the repository property into consideration if the FF is not enabled.
if (!useRepositoryProperty) {
return undefined;
}
const propertyValue =
repositoryProperties[RepositoryPropertyName.CONFIG_FILE];
if (propertyValue !== undefined && propertyValue.trim().length > 0) {
logger.info(
`Using configuration file input from repository property: ${propertyValue}`,
);
return propertyValue;
// Only use the repository property value if the FF is enabled.
if (useRepositoryProperty) {
logger.info(
`Using configuration file input from repository property: ${propertyValue}`,
);
return propertyValue;
} else {
logger.info(
"Ignoring configuration file input from repository property, because the corresponding feature flag is disabled.",
);
}
}
return undefined;