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

8
lib/init-action.js generated
View file

@ -343,10 +343,12 @@ async function run() {
logger.warning("The CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION environment variable is deprecated and no longer has any effect. We recommend removing any references from your workflows. See https://github.blog/changelog/2024-01-23-codeql-2-16-python-dependency-installation-disabled-new-queries-and-bug-fixes/ for more information.");
}
if (await codeql.supportsFeature(tools_features_1.ToolsFeature.PythonDefaultIsToNotExtractStdlib)) {
// We are in the case where the default has switched to not extracting the stdlib.
if (!(await features.getValue(feature_flags_1.Feature.PythonDefaultIsToNotExtractStdlib, codeql))) {
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_flags_1.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");
}
}

File diff suppressed because one or more lines are too long

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");
}
}