Check that stats isn't undefined before trying to call isDirectory

This commit is contained in:
Michael B. Gale
2025-08-07 11:25:01 +01:00
parent 43638b10a0
commit 0d72a5b371
3 changed files with 9 additions and 3 deletions

4
lib/config-utils.js generated
View File

@@ -160,7 +160,9 @@ const baseWorkflowsPath = ".github/workflows";
function hasActionsWorkflows(sourceRoot) {
const workflowsPath = path.resolve(sourceRoot, baseWorkflowsPath);
const stats = fs.lstatSync(workflowsPath);
return stats.isDirectory() && fs.readdirSync(workflowsPath).length > 0;
return (stats !== undefined &&
stats.isDirectory() &&
fs.readdirSync(workflowsPath).length > 0);
}
/**
* Gets the set of languages in the current repository.