mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 01:08:46 +00:00
Merge pull request #3084 from github/mbg/fix/hasActionsWorkflows
Fix `hasActionsWorkflows` throwing an exception if the workflows folder doesn't exist
This commit is contained in:
Generated
+1
-1
@@ -87169,7 +87169,7 @@ async function getSupportedLanguageMap(codeql) {
|
||||
var baseWorkflowsPath = ".github/workflows";
|
||||
function hasActionsWorkflows(sourceRoot) {
|
||||
const workflowsPath = path10.resolve(sourceRoot, baseWorkflowsPath);
|
||||
const stats = fs9.lstatSync(workflowsPath);
|
||||
const stats = fs9.lstatSync(workflowsPath, { throwIfNoEntry: false });
|
||||
return stats !== void 0 && stats.isDirectory() && fs9.readdirSync(workflowsPath).length > 0;
|
||||
}
|
||||
async function getRawLanguagesInRepo(repository, sourceRoot, logger) {
|
||||
|
||||
@@ -1755,3 +1755,9 @@ for (const language in KnownLanguage) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
test("hasActionsWorkflows doesn't throw if workflows folder doesn't exist", async (t) => {
|
||||
return withTmpDir(async (tmpDir) => {
|
||||
t.notThrows(() => configUtils.hasActionsWorkflows(tmpDir));
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -341,7 +341,7 @@ const baseWorkflowsPath = ".github/workflows";
|
||||
*/
|
||||
export function hasActionsWorkflows(sourceRoot: string): boolean {
|
||||
const workflowsPath = path.resolve(sourceRoot, baseWorkflowsPath);
|
||||
const stats = fs.lstatSync(workflowsPath);
|
||||
const stats = fs.lstatSync(workflowsPath, { throwIfNoEntry: false });
|
||||
return (
|
||||
stats !== undefined &&
|
||||
stats.isDirectory() &&
|
||||
|
||||
Reference in New Issue
Block a user