fix for cache

This commit is contained in:
aparnajyothi-y 2023-12-12 18:39:15 +05:30 committed by GitHub
parent 5ef044f9d0
commit d696146496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,10 +12,20 @@ process.on('uncaughtException', e => {
core.info(`${warningPrefix}${e.message}`);
});
export async function run() {
// Added early exit to resolve issue with slow post action step:
export async function run(earlyExit?: boolean) {
try {
const cacheLock = core.getState(State.CachePackageManager);
await cachePackages(cacheLock);
if (cacheLock) {
await cachePackages(cacheLock);
if (earlyExit) {
process.exit(0);
}
} else {
core.debug(`Caching for '${cacheLock}' is not supported`);
}
} catch (error) {
core.setFailed((error as Error).message);
}
@ -58,4 +68,4 @@ const cachePackages = async (packageManager: string) => {
core.info(`Cache saved with the key: ${primaryKey}`);
};
run();
run(true);