mirror of
https://github.com/github/codeql-action.git
synced 2026-01-05 06:00:32 +08:00
Merge branch 'main' into mbg/suppress-go-workaround-warning
This commit is contained in:
@@ -17,7 +17,13 @@ import { CodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, Features } from "./feature-flags";
|
||||
import { initCodeQL, initConfig, installPythonDeps, runInit } from "./init";
|
||||
import {
|
||||
checkInstallPython311,
|
||||
initCodeQL,
|
||||
initConfig,
|
||||
installPythonDeps,
|
||||
runInit,
|
||||
} from "./init";
|
||||
import { Language } from "./languages";
|
||||
import { getActionsLogger, Logger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
@@ -277,6 +283,8 @@ async function run() {
|
||||
logger,
|
||||
);
|
||||
|
||||
await checkInstallPython311(config.languages, codeql);
|
||||
|
||||
if (
|
||||
config.languages.includes(Language.python) &&
|
||||
getRequiredInput("setup-python-dependencies") === "true"
|
||||
|
||||
25
src/init.ts
25
src/init.ts
@@ -13,6 +13,7 @@ import {
|
||||
FeatureEnablement,
|
||||
useCodeScanningConfigInCli,
|
||||
} from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { RepositoryNwo } from "./repository";
|
||||
import { ToolsSource } from "./setup-codeql";
|
||||
@@ -181,6 +182,30 @@ function processError(e: any): Error {
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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[],
|
||||
codeql: CodeQL,
|
||||
) {
|
||||
if (
|
||||
languages.includes(Language.python) &&
|
||||
process.platform === "win32" &&
|
||||
!(await codeql.getVersion()).features?.supportsPython312
|
||||
) {
|
||||
const script = path.resolve(
|
||||
__dirname,
|
||||
"../python-setup",
|
||||
"check_python12.ps1",
|
||||
);
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
||||
script,
|
||||
]).exec();
|
||||
}
|
||||
}
|
||||
|
||||
export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
|
||||
logger.startGroup("Setup Python dependencies");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user