mirror of
https://github.com/actions/setup-python.git
synced 2025-12-09 14:15:21 +00:00
fix: reorganize post actions
This commit is contained in:
parent
bf9c5d876c
commit
c7d4148a08
@ -13,6 +13,6 @@ export async function cleanPipPackages() {
|
||||
]);
|
||||
core.info('Successfully cleaned up pip packages');
|
||||
} catch (error) {
|
||||
core.setFailed(`Failed to clean up pip packages.`);
|
||||
core.setFailed('Failed to clean up pip packages.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,17 @@ import {State} from './cache-distributions/cache-distributor';
|
||||
export async function run(earlyExit?: boolean) {
|
||||
try {
|
||||
const cache = core.getInput('cache');
|
||||
if (cache) {
|
||||
await saveCache(cache);
|
||||
// Optionally clean up pip packages after the post-action if requested.
|
||||
// This mirrors the `preclean` behavior used in the main action.
|
||||
const postcleanPip = core.getBooleanInput('postclean');
|
||||
|
||||
if (cache || postcleanPip) {
|
||||
if (cache) {
|
||||
await saveCache(cache);
|
||||
}
|
||||
if (postcleanPip) {
|
||||
await cleanPipPackages();
|
||||
}
|
||||
// Preserve early-exit behavior for the post action when requested.
|
||||
// Some CI setups may want the post step to exit early to avoid long-running
|
||||
// processes during cleanup. If enabled, exit with success immediately.
|
||||
@ -20,12 +29,6 @@ export async function run(earlyExit?: boolean) {
|
||||
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.
|
||||
const postcleanPip = core.getBooleanInput('postclean');
|
||||
if (postcleanPip) {
|
||||
await cleanPipPackages();
|
||||
}
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
core.setFailed(err.message);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user