Allow getCheckoutPathInputOrThrow to get root from config

This commit is contained in:
Michael B. Gale
2026-09-22 12:09:16 +01:00
parent 54a43494ca
commit f5716fadf4
4 changed files with 180 additions and 19 deletions

29
lib/entry-points.js generated
View File

@@ -162185,14 +162185,20 @@ function getUploadInputOrThrow(workflow, jobName, matrixVars) {
matrixVars
);
}
function getCheckoutPathInputOrThrow(workflow, jobName, matrixVars) {
return getInputOrThrow(
workflow,
jobName,
getAnalyzeActionName(),
"checkout_path",
matrixVars
) || getRequiredEnvParam("GITHUB_WORKSPACE");
function getRepositoryRootOrThrow(workflow, jobName, matrixVars, config, env = getEnv()) {
return (
// If the CodeQL Action already has a persisted repository root, then we can just use that.
config.repositoryRoot ?? // Otherwise, try to retrieve it from a `checkout_path` input in the workflow specification.
getInputOrThrow(
workflow,
jobName,
getAnalyzeActionName(),
"checkout_path",
matrixVars
) ?? // Finally, if all of the above fail, just use the value of `GITHUB_WORKSPACE` since that
// is what is used by default.
env.getRequired("GITHUB_WORKSPACE" /* GITHUB_WORKSPACE */)
);
}
async function checkWorkflow(logger, codeql) {
if (!isDynamicWorkflow() && process.env["CODEQL_ACTION_SKIP_WORKFLOW_VALIDATION" /* SKIP_WORKFLOW_VALIDATION */] !== "true") {
@@ -162763,7 +162769,12 @@ async function prepareFailedSarif(logger, features, config) {
});
}
const category = getCategoryInputOrThrow(workflow, jobName, matrix);
const checkoutPath = getCheckoutPathInputOrThrow(workflow, jobName, matrix);
const checkoutPath = getRepositoryRootOrThrow(
workflow,
jobName,
matrix,
config
);
const result = await generateFailedSarif(
logger,
features,