mirror of
https://github.com/actions/setup-python.git
synced 2025-12-10 22:55:20 +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');
|
core.info('Successfully cleaned up pip packages');
|
||||||
} catch (error) {
|
} 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) {
|
export async function run(earlyExit?: boolean) {
|
||||||
try {
|
try {
|
||||||
const cache = core.getInput('cache');
|
const cache = core.getInput('cache');
|
||||||
if (cache) {
|
// Optionally clean up pip packages after the post-action if requested.
|
||||||
await saveCache(cache);
|
// 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.
|
// 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
|
// Some CI setups may want the post step to exit early to avoid long-running
|
||||||
// processes during cleanup. If enabled, exit with success immediately.
|
// processes during cleanup. If enabled, exit with success immediately.
|
||||||
@ -20,12 +29,6 @@ export async function run(earlyExit?: boolean) {
|
|||||||
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.
|
|
||||||
const postcleanPip = core.getBooleanInput('postclean');
|
|
||||||
if (postcleanPip) {
|
|
||||||
await cleanPipPackages();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const err = error as Error;
|
const err = error as Error;
|
||||||
core.setFailed(err.message);
|
core.setFailed(err.message);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user