1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-10 21:32:19 +02:00

feature: add update-environment input (#411)

This option allows to specify if the action shall update environment variables (default) or not.
This allows to use the setup-python action in a composite action without side effect (except downloading/installing python if version is missing).
This commit is contained in:
Matthieu Darbois 2022-06-29 17:00:51 +02:00 committed by GitHub
parent ffcd00020c
commit 00a5248c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2083 additions and 1552 deletions

View file

@ -64,14 +64,23 @@ async function run() {
if (version) {
let pythonVersion: string;
const arch: string = core.getInput('architecture') || os.arch();
const updateEnvironment = core.getBooleanInput('update-environment');
if (isPyPyVersion(version)) {
const installed = await finderPyPy.findPyPyVersion(version, arch);
const installed = await finderPyPy.findPyPyVersion(
version,
arch,
updateEnvironment
);
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
core.info(
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
);
} else {
const installed = await finder.useCpythonVersion(version, arch);
const installed = await finder.useCpythonVersion(
version,
arch,
updateEnvironment
);
pythonVersion = installed.version;
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
}