Skip to content

Commit

Permalink
Add a feature flag to turn this off for newer versions of codeql
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenberg committed Oct 6, 2023
1 parent 028bacb commit bd30ad1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python312-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
version: default

- name: Initialize CodeQL
uses: ./../init
uses: ./../action/init
with:
tools: latest
languages: python
Expand Down
5 changes: 5 additions & 0 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export const CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
*/
export const CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";

/**
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
*/
export const CODEQL_VERSION_SUPPORTS_PYTHON_3_12 = "2.15.0";

export interface CodeQLDefaultVersionInfo {
cliVersion: string;
tagName: string;
Expand Down
2 changes: 1 addition & 1 deletion src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async function run() {
logger,
);

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

if (
config.languages.includes(Language.python) &&
Expand Down
15 changes: 13 additions & 2 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
import { CodeQL, setupCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import {
CODEQL_VERSION_SUPPORTS_PYTHON_3_12,
CodeQLDefaultVersionInfo,
FeatureEnablement,
useCodeScanningConfigInCli,
Expand Down Expand Up @@ -186,8 +187,18 @@ function processError(e: any): Error {
* If we are running python 3.12+ on windows, we need to switch to python 3.11.
* This check happens in a powershell script.
*/
export async function checkInstallPython311(languages: Language[]) {
if (languages.includes(Language.python) && process.platform === "win32") {
export async function checkInstallPython311(
languages: Language[],
codeql: CodeQL,
) {
if (
languages.includes(Language.python) &&
process.platform === "win32" &&
!(await util.codeQlVersionAbove(
codeql,
CODEQL_VERSION_SUPPORTS_PYTHON_3_12,
))
) {
const script = path.resolve(
__dirname,
"../python-setup",
Expand Down

0 comments on commit bd30ad1

Please sign in to comment.