mirror of
https://github.com/actions/setup-node
synced 2024-12-22 13:12:43 +00:00
Add fix for cache (#917)
This commit is contained in:
parent
5ef044f9d0
commit
ec97f37504
2 changed files with 1743 additions and 1724 deletions
15
dist/cache-save/index.js
vendored
15
dist/cache-save/index.js
vendored
|
@ -82953,11 +82953,20 @@ process.on('uncaughtException', e => {
|
||||||
const warningPrefix = '[warning]';
|
const warningPrefix = '[warning]';
|
||||||
core.info(`${warningPrefix}${e.message}`);
|
core.info(`${warningPrefix}${e.message}`);
|
||||||
});
|
});
|
||||||
function run() {
|
// Added early exit to resolve issue with slow post action step:
|
||||||
|
function run(earlyExit) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const cacheLock = core.getState(constants_1.State.CachePackageManager);
|
const cacheLock = core.getState(constants_1.State.CachePackageManager);
|
||||||
yield cachePackages(cacheLock);
|
if (cacheLock) {
|
||||||
|
yield cachePackages(cacheLock);
|
||||||
|
if (earlyExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug(`Caching for '${cacheLock}' is not supported`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
@ -82990,7 +82999,7 @@ const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, func
|
||||||
}
|
}
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
});
|
});
|
||||||
run();
|
run(true);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
|
@ -12,10 +12,20 @@ process.on('uncaughtException', e => {
|
||||||
core.info(`${warningPrefix}${e.message}`);
|
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 {
|
try {
|
||||||
const cacheLock = core.getState(State.CachePackageManager);
|
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) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message);
|
core.setFailed((error as Error).message);
|
||||||
}
|
}
|
||||||
|
@ -58,4 +68,4 @@ const cachePackages = async (packageManager: string) => {
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
run();
|
run(true);
|
||||||
|
|
Loading…
Reference in a new issue