Skip to content

Commit 17c5ab2

Browse files
authored
Merge pull request #2161 from github/henrymercer/path-filter-warning-cli
Only warn about path filters in the Action if the CLI doesn't already warn
2 parents 25d334f + eb991df commit 17c5ab2

File tree

9 files changed

+55
-35
lines changed

9 files changed

+55
-35
lines changed

lib/init-action.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-features.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-features.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init-action.ts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -262,33 +262,38 @@ async function run() {
262262
}
263263
core.endGroup();
264264

265-
config = await initConfig({
266-
languagesInput: getOptionalInput("languages"),
267-
queriesInput: getOptionalInput("queries"),
268-
packsInput: getOptionalInput("packs"),
269-
buildModeInput: getOptionalInput("build-mode"),
270-
configFile: getOptionalInput("config-file"),
271-
dbLocation: getOptionalInput("db-location"),
272-
configInput: getOptionalInput("config"),
273-
trapCachingEnabled: getTrapCachingEnabled(),
274-
// Debug mode is enabled if:
275-
// - The `init` Action is passed `debug: true`.
276-
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
277-
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
278-
debugMode: getOptionalInput("debug") === "true" || core.isDebug(),
279-
debugArtifactName:
280-
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
281-
debugDatabaseName:
282-
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
283-
repository: repositoryNwo,
284-
tempDir: getTemporaryDirectory(),
265+
config = await initConfig(
266+
{
267+
languagesInput: getOptionalInput("languages"),
268+
queriesInput: getOptionalInput("queries"),
269+
packsInput: getOptionalInput("packs"),
270+
buildModeInput: getOptionalInput("build-mode"),
271+
configFile: getOptionalInput("config-file"),
272+
dbLocation: getOptionalInput("db-location"),
273+
configInput: getOptionalInput("config"),
274+
trapCachingEnabled: getTrapCachingEnabled(),
275+
// Debug mode is enabled if:
276+
// - The `init` Action is passed `debug: true`.
277+
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
278+
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
279+
debugMode: getOptionalInput("debug") === "true" || core.isDebug(),
280+
debugArtifactName:
281+
getOptionalInput("debug-artifact-name") ||
282+
DEFAULT_DEBUG_ARTIFACT_NAME,
283+
debugDatabaseName:
284+
getOptionalInput("debug-database-name") ||
285+
DEFAULT_DEBUG_DATABASE_NAME,
286+
repository: repositoryNwo,
287+
tempDir: getTemporaryDirectory(),
288+
codeql,
289+
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
290+
githubVersion: gitHubVersion,
291+
apiDetails,
292+
features,
293+
logger,
294+
},
285295
codeql,
286-
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
287-
githubVersion: gitHubVersion,
288-
apiDetails,
289-
features,
290-
logger,
291-
});
296+
);
292297

293298
await checkInstallPython311(config.languages, codeql);
294299

src/init.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { CodeQLDefaultVersionInfo } from "./feature-flags";
1111
import { Language, isScannedLanguage } from "./languages";
1212
import { Logger } from "./logging";
1313
import { ToolsSource } from "./setup-codeql";
14+
import { ToolsFeature } from "./tools-features";
1415
import { TracerConfig, getCombinedTracerConfig } from "./tracer-config";
1516
import * as util from "./util";
1617

@@ -45,11 +46,18 @@ export async function initCodeQL(
4546

4647
export async function initConfig(
4748
inputs: configUtils.InitConfigInputs,
49+
codeql: CodeQL,
4850
): Promise<configUtils.Config> {
4951
const logger = inputs.logger;
5052
logger.startGroup("Load language configuration");
5153
const config = await configUtils.initConfig(inputs);
52-
printPathFiltersWarning(config, logger);
54+
if (
55+
!(await codeql.supportsFeature(
56+
ToolsFeature.InformsAboutUnsupportedPathFilters,
57+
))
58+
) {
59+
printPathFiltersWarning(config, logger);
60+
}
5361
logger.endGroup();
5462
return config;
5563
}

src/tools-features.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { VersionInfo } from "./codeql";
33
export enum ToolsFeature {
44
BuildModeOption = "buildModeOption",
55
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
6+
InformsAboutUnsupportedPathFilters = "informsAboutUnsupportedPathFilters",
67
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
78
TraceCommandUseBuildMode = "traceCommandUseBuildMode",
89
}

0 commit comments

Comments
 (0)