diff --git a/dist/setup/index.js b/dist/setup/index.js index ec5261ef..2c450a64 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -97729,7 +97729,14 @@ function run() { } } else { - core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.'); + const trueValue = ['true', 'True', 'TRUE']; + const pythonVersionRequired = process.env['PYTHON_VERSION_REQUIRED'] || ''; + if (!trueValue.includes(pythonVersionRequired)) { + core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.'); + } + else { + throw new Error(`The python-version input is required.`); + } } const matchersPath = path.join(__dirname, '../..', '.github'); core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`); diff --git a/src/setup-python.ts b/src/setup-python.ts index ab5931b8..fd303721 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -146,9 +146,17 @@ async function run() { await cacheDependencies(cache, pythonVersion); } } else { - core.warning( - 'The `python-version` input is not set. The version of Python currently in `PATH` will be used.' - ); + const trueValue = ['true', 'True', 'TRUE']; + const pythonVersionRequired = process.env['PYTHON_VERSION_REQUIRED'] || ''; + if(!trueValue.includes(pythonVersionRequired)) { + core.warning( + 'The `python-version` input is not set. The version of Python currently in `PATH` will be used.' + ); + } else { + throw new Error( + `The python-version input is required.` + ); + } } const matchersPath = path.join(__dirname, '../..', '.github'); core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);