From 64ebf10c1d6e5d668d4847ca688216e43c0c52dc Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 8 Oct 2020 16:12:40 +0200 Subject: [PATCH] Don't use ::set-env in python-setup Is now deprecated as described in https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ --- python-setup/auto_install_packages.py | 5 ++++- python-setup/tests/from_python_exe.py | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/python-setup/auto_install_packages.py b/python-setup/auto_install_packages.py index cdb70c6d6..7b768bfd9 100755 --- a/python-setup/auto_install_packages.py +++ b/python-setup/auto_install_packages.py @@ -142,5 +142,8 @@ def install_packages(codeql_base_dir) -> Optional[str]: python_executable_path = install_packages(codeql_base_dir) if python_executable_path is not None: + # see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + env_file = open(os.environ["GITHUB_ENV"], mode="at") + print("Setting CODEQL_PYTHON={}".format(python_executable_path)) - print("::set-env name=CODEQL_PYTHON::{}".format(python_executable_path)) + print("CODEQL_PYTHON={}".format(python_executable_path), file=env_file) diff --git a/python-setup/tests/from_python_exe.py b/python-setup/tests/from_python_exe.py index 69e2e873e..19702cf37 100755 --- a/python-setup/tests/from_python_exe.py +++ b/python-setup/tests/from_python_exe.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import sys +import os import subprocess from typing import Tuple @@ -24,8 +25,11 @@ def get_details(path_to_python_exe: str) -> Tuple[str, str]: if __name__ == "__main__": version, import_path = get_details(sys.argv[1]) + # see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + env_file = open(os.environ["GITHUB_ENV"], mode="at") + print("Setting LGTM_PYTHON_SETUP_VERSION={}".format(version)) - print("::set-env name=LGTM_PYTHON_SETUP_VERSION::{}".format(version)) + print("LGTM_PYTHON_SETUP_VERSION={}".format(version), file=env_file) print("Setting LGTM_INDEX_IMPORT_PATH={}".format(import_path)) - print("::set-env name=LGTM_INDEX_IMPORT_PATH::{}".format(import_path)) \ No newline at end of file + print("LGTM_INDEX_IMPORT_PATH={}".format(import_path), file=env_file)