Don't override env var if it is already set

This commit is contained in:
Henry Mercer 2024-10-17 12:05:48 +01:00
parent d591d172c8
commit 5d314b71b0
3 changed files with 12 additions and 7 deletions

View file

@ -594,15 +594,18 @@ async function run() {
ToolsFeature.PythonDefaultIsToNotExtractStdlib,
)
) {
// We are in the case where the default has switched to not extracting the stdlib.
if (
if (process.env["CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB"]) {
logger.debug(
"CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB is already set, so the Action will not override it.",
);
} else if (
!(await features.getValue(
Feature.PythonDefaultIsToNotExtractStdlib,
codeql,
))
) {
// We are in a situation where the feature flag is not rolled out,
// so we need to suppress the new default behavior.
// so we need to suppress the new default CLI behavior.
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB", "true");
}
}