Skip to content

Commit 9cab82f

Browse files
Merge pull request #1018 from github/edoardo/revert-codescanning-config
Revert usage of `--codescanning-config` flag
2 parents f090899 + 43d0664 commit 9cab82f

File tree

7 files changed

+10
-71
lines changed

7 files changed

+10
-71
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## [UNRELEASED]
44

5-
No user facing changes.
5+
- A bug where additional queries specified in the workflow file would sometimes not be respected has been fixed. [#1018](https://github.com/github/codeql-action/pull/1018)
66

77
## 2.1.6 - 30 Mar 2022
88

lib/analyze.js

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

+3-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as yaml from "js-yaml";
66

77
import * as analysisPaths from "./analysis-paths";
88
import {
9-
CODEQL_VERSION_CONFIG_FILES,
109
CODEQL_VERSION_COUNTS_LINES,
1110
CODEQL_VERSION_NEW_TRACING,
1211
getCodeQL,
@@ -238,10 +237,7 @@ export async function runQueries(
238237

239238
const codeql = await getCodeQL(config.codeQLCmd);
240239
try {
241-
if (
242-
hasPackWithCustomQueries &&
243-
!(await util.codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES))
244-
) {
240+
if (hasPackWithCustomQueries) {
245241
logger.info("Performing analysis with custom CodeQL Packs.");
246242
logger.startGroup(`Downloading custom packs for ${language}`);
247243

src/codeql.ts

+2-30
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as path from "path";
44
import * as toolrunner from "@actions/exec/lib/toolrunner";
55
import { IHeaders } from "@actions/http-client/interfaces";
66
import { default as deepEqual } from "fast-deep-equal";
7-
import * as yaml from "js-yaml";
87
import { default as queryString } from "query-string";
98
import * as semver from "semver";
109

@@ -220,7 +219,6 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
220219
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
221220
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2";
222221
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
223-
export const CODEQL_VERSION_CONFIG_FILES = "2.8.2"; // Versions before 2.8.2 weren't tolerant to unknown properties
224222
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";
225223

226224
/**
@@ -735,28 +733,6 @@ async function getCodeQLForCmd(
735733
extraArgs.push(`--trace-process-level=${processLevel || 3}`);
736734
}
737735
}
738-
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES)) {
739-
const configLocation = path.resolve(config.tempDir, "user-config.yaml");
740-
const augmentedConfig = config.originalUserInput;
741-
if (config.injectedMlQueries) {
742-
// We need to inject the ML queries into the original user input before
743-
// we pass this on to the CLI, to make sure these get run.
744-
const pack = await util.getMlPoweredJsQueriesPack(codeql);
745-
const packString =
746-
pack.packName + (pack.version ? `@${pack.version}` : "");
747-
748-
if (augmentedConfig.packs === undefined) augmentedConfig.packs = [];
749-
if (Array.isArray(augmentedConfig.packs)) {
750-
augmentedConfig.packs.push(packString);
751-
} else {
752-
if (!augmentedConfig.packs.javascript)
753-
augmentedConfig.packs["javascript"] = [];
754-
augmentedConfig.packs["javascript"].push(packString);
755-
}
756-
}
757-
fs.writeFileSync(configLocation, yaml.dump(augmentedConfig));
758-
extraArgs.push(`--codescanning-config=${configLocation}`);
759-
}
760736
await runTool(cmd, [
761737
"database",
762738
"init",
@@ -914,9 +890,7 @@ async function getCodeQLForCmd(
914890
if (extraSearchPath !== undefined) {
915891
codeqlArgs.push("--additional-packs", extraSearchPath);
916892
}
917-
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
918-
codeqlArgs.push(querySuitePath);
919-
}
893+
codeqlArgs.push(querySuitePath);
920894
await runTool(cmd, codeqlArgs);
921895
},
922896
async databaseInterpretResults(
@@ -952,9 +926,7 @@ async function getCodeQLForCmd(
952926
codeqlArgs.push("--sarif-category", automationDetailsId);
953927
}
954928
codeqlArgs.push(databasePath);
955-
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
956-
codeqlArgs.push(...querySuitePaths);
957-
}
929+
codeqlArgs.push(...querySuitePaths);
958930
// capture stdout, which contains analysis summaries
959931
return await runTool(cmd, codeqlArgs);
960932
},

0 commit comments

Comments
 (0)