Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Python: Don't install deps by default for all users
  • Loading branch information
RasmusWL committed Dec 13, 2023
commit 2f93dd472e71659dd56d268ec93f823b145537f5
4 changes: 4 additions & 0 deletions src/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ async function setupPythonExtractor(
await features.getValue(
Feature.DisablePythonDependencyInstallationEnabled,
codeql,
) ||
await features.getValue(
Feature.PythonDefaultIsToSkipDependencyInstallationEnabled,
codeql,
)
) {
logger.warning(
Expand Down
11 changes: 11 additions & 0 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export enum Feature {
CppDependencyInstallation = "cpp_dependency_installation_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
// NOTE: `python_default_is_to_skip_dependency_installation_enabled` is never actually returned by the GitHub API.
PythonDefaultIsToSkipDependencyInstallationEnabled = "python_default_is_to_skip_dependency_installation_enabled",
EvaluatorFineGrainedParallelismEnabled = "evaluator_fine_grained_parallelism_enabled",
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
QaTelemetryEnabled = "qa_telemetry_enabled",
Expand Down Expand Up @@ -103,6 +105,15 @@ export const featureConfig: Record<
minimumVersion: undefined,
defaultValue: false,
},
[Feature.PythonDefaultIsToSkipDependencyInstallationEnabled]: {
// we can reuse the same environment variable as above. If someone has set it to
// `true` in their workflow this means dependencies are not installed, setting it to
// `false` means dependencies _will_ be installed. The same semantics are applied
// here!
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
minimumVersion: "2.16.0",
defaultValue: true,
},
};

/**
Expand Down
8 changes: 8 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ async function run() {
await features.getValue(
Feature.DisablePythonDependencyInstallationEnabled,
codeql,
) ||
await features.getValue(
Feature.PythonDefaultIsToSkipDependencyInstallationEnabled,
codeql,
)
) {
logger.info("Skipping python dependency installation");
Expand Down Expand Up @@ -450,6 +454,10 @@ async function run() {
await features.getValue(
Feature.DisablePythonDependencyInstallationEnabled,
codeql,
) ||
await features.getValue(
Feature.PythonDefaultIsToSkipDependencyInstallationEnabled,
codeql,
)
) {
core.exportVariable(
Expand Down