Verify persisted repository root path in analyze action

This commit is contained in:
Michael B. Gale
2026-09-16 15:27:29 +01:00
parent 5dab0ccf51
commit ba615b5d9d
3 changed files with 27 additions and 3 deletions

13
lib/entry-points.js generated
View File

@@ -153805,7 +153805,7 @@ var CodeQLAnalysisError = class extends Error {
message;
error;
};
async function determineCheckoutPath(action) {
async function determineCheckoutPath(action, config) {
const checkoutPathInput = action.actions.getRequiredInput("checkout_path");
const repositoryRoot = await getGitRoot(checkoutPathInput);
if (repositoryRoot === void 0) {
@@ -153824,6 +153824,15 @@ async function determineCheckoutPath(action) {
"Set the 'checkout_path' input for the 'codeql-action/analyze' step to the root path of the checkout."
].join(" ")
);
} else if (config.repositoryRoot !== void 0 && repositoryRoot !== config.repositoryRoot) {
action.logger.warning(
[
`The repository path at '${repositoryRoot}' does not match that found by the 'codeql-action/init' step: '${config.repositoryRoot}'.`,
"Ensure that the 'checkout_path' input for the 'codeql-action/analyze' step is set to the path of the same repository that",
"the 'codeql-action/init' step determined. This is either the GitHub Actions workspace or the repository root corresponding to",
"the 'source-root' input if that was provided."
].join(" ")
);
}
return checkoutPathInput;
}
@@ -156638,7 +156647,7 @@ async function run(action) {
getOptionalInput("ram") || process.env["CODEQL_RAM"],
logger
);
const checkoutPath = await determineCheckoutPath(action);
const checkoutPath = await determineCheckoutPath(action, config);
const diffRangePackDir = await setupDiffInformedQueryRun(
logger,
checkoutPath