add first clean up work

Signed-off-by: jylenhof <jygithub@lenhof.eu.org>
This commit is contained in:
jylenhof 2025-11-16 00:30:29 +01:00
parent 97aeb3efb8
commit b2cf62bdce
5 changed files with 50 additions and 6 deletions

18
src/clean-pip.ts Normal file
View file

@ -0,0 +1,18 @@
import * as core from '@actions/core';
import {exec} from '@actions/exec';
// Shared helper to uninstall all pip packages in the current environment.
export async function cleanPipPackages() {
core.info('Cleaning up pip packages');
try {
// uninstall all currently installed packages (if any)
// Use a shell so we can pipe the output of pip freeze into xargs
await exec('bash', [
'-c',
'python -m pip freeze | xargs python -m pip uninstall'
]);
core.info('Successfully cleaned up pip packages');
} catch (error) {
core.setFailed(`Failed to clean up pip packages.`);
}
}