Populate path filters env variables using the CLI

This commit is contained in:
Henry Mercer 2024-01-04 15:17:20 +00:00
parent b30262ccb4
commit f934b28e51
12 changed files with 26 additions and 407 deletions

View file

@ -4,12 +4,11 @@ import * as path from "path";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as safeWhich from "@chrisgavin/safe-which";
import * as analysisPaths from "./analysis-paths";
import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
import { CodeQL, setupCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { CodeQLDefaultVersionInfo } from "./feature-flags";
import { Language } from "./languages";
import { Language, isScannedLanguage } from "./languages";
import { Logger } from "./logging";
import { RepositoryNwo } from "./repository";
import { ToolsSource } from "./setup-codeql";
@ -84,7 +83,7 @@ export async function initConfig(
apiDetails,
logger,
);
analysisPaths.printPathFiltersWarning(config, logger);
printPathFiltersWarning(config, logger);
logger.endGroup();
return config;
}
@ -128,6 +127,19 @@ export async function runInit(
return await getCombinedTracerConfig(config);
}
function printPathFiltersWarning(config: configUtils.Config, logger: Logger) {
// Index include/exclude/filters only work in javascript/python/ruby.
// If any other languages are detected/configured then show a warning.
if (
(config.paths.length !== 0 || config.pathsIgnore.length !== 0) &&
!config.languages.every(isScannedLanguage)
) {
logger.warning(
'The "paths"/"paths-ignore" fields of the config only have effect for JavaScript, Python, and Ruby',
);
}
}
/**
* Possibly convert this error into a UserError in order to avoid
* counting this error towards our internal error budget.