Signed-off-by: Jean-Yves LENHOF <jeanyves.lenhof.partner@decathlon.com>
This commit is contained in:
Jean-Yves LENHOF 2025-11-18 11:03:15 +01:00
parent 4a23520ba4
commit bf9c5d876c
3 changed files with 10 additions and 14 deletions

View File

@ -33,10 +33,10 @@ inputs:
description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]." description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]."
pip-install: pip-install:
description: "Used to specify the packages to install with pip after setting up Python. Can be a requirements file or package names." description: "Used to specify the packages to install with pip after setting up Python. Can be a requirements file or package names."
preclean-pip: preclean:
description: "When 'true', removes all existing pip packages before installing new ones." description: "When 'true', removes all existing pip packages before installing new ones."
default: false default: false
postclean-pip: postclean:
description: "When 'true', removes all pip packages installed by this action after the action completes." description: "When 'true', removes all pip packages installed by this action after the action completes."
default: false default: false
outputs: outputs:
@ -49,7 +49,7 @@ outputs:
runs: runs:
using: 'node24' using: 'node24'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cache-save/index.js' post: 'dist/post-python/index.js'
post-if: success() post-if: success()
branding: branding:
icon: 'code' icon: 'code'

View File

@ -19,16 +19,12 @@ export async function run(earlyExit?: boolean) {
if (earlyExit) { if (earlyExit) {
process.exit(0); process.exit(0);
} }
// Optionally clean up pip packages after the post-action if requested. }
// This mirrors the `preclean-pip` behavior used in the main action. // Optionally clean up pip packages after the post-action if requested.
try { // This mirrors the `preclean-pip` behavior used in the main action.
const postcleanPip = core.getBooleanInput('postclean-pip'); const postcleanPip = core.getBooleanInput('postclean');
if (postcleanPip) { if (postcleanPip) {
await cleanPipPackages(); await cleanPipPackages();
}
} catch (err) {
// getBooleanInput throws if input missing in some contexts; ignore and continue
}
} }
} catch (error) { } catch (error) {
const err = error as Error; const err = error as Error;

View File

@ -160,7 +160,7 @@ async function run() {
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
await cacheDependencies(cache, pythonVersion); await cacheDependencies(cache, pythonVersion);
} }
const precleanPip = core.getBooleanInput('preclean-pip'); const precleanPip = core.getBooleanInput('preclean');
if (precleanPip) { if (precleanPip) {
await cleanPipPackages(); await cleanPipPackages();
} }