Skip to content

Commit bd30ad1

Browse files
committed
Add a feature flag to turn this off for newer versions of codeql
1 parent 028bacb commit bd30ad1

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.github/workflows/python312-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
version: default
3131

3232
- name: Initialize CodeQL
33-
uses: ./../init
33+
uses: ./../action/init
3434
with:
3535
tools: latest
3636
languages: python

src/feature-flags.ts

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
3434
*/
3535
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
3636

37+
/**
38+
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
39+
*/
40+
export const CODEQL_VERSION_SUPPORTS_PYTHON_3_12 = "2.15.0";
41+
3742
export interface CodeQLDefaultVersionInfo {
3843
cliVersion: string;
3944
tagName: string;

src/init-action.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ async function run() {
283283
logger,
284284
);
285285

286-
await checkInstallPython311(config.languages);
286+
await checkInstallPython311(config.languages, codeql);
287287

288288
if (
289289
config.languages.includes(Language.python) &&

src/init.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
99
import { CodeQL, setupCodeQL } from "./codeql";
1010
import * as configUtils from "./config-utils";
1111
import {
12+
CODEQL_VERSION_SUPPORTS_PYTHON_3_12,
1213
CodeQLDefaultVersionInfo,
1314
FeatureEnablement,
1415
useCodeScanningConfigInCli,
@@ -186,8 +187,18 @@ function processError(e: any): Error {
186187
* If we are running python 3.12+ on windows, we need to switch to python 3.11.
187188
* This check happens in a powershell script.
188189
*/
189-
export async function checkInstallPython311(languages: Language[]) {
190-
if (languages.includes(Language.python) && process.platform === "win32") {
190+
export async function checkInstallPython311(
191+
languages: Language[],
192+
codeql: CodeQL,
193+
) {
194+
if (
195+
languages.includes(Language.python) &&
196+
process.platform === "win32" &&
197+
!(await util.codeQlVersionAbove(
198+
codeql,
199+
CODEQL_VERSION_SUPPORTS_PYTHON_3_12,
200+
))
201+
) {
191202
const script = path.resolve(
192203
__dirname,
193204
"../python-setup",

0 commit comments

Comments
 (0)