Files
actions-setup-node/src/cache-save.ts
T
Haritha 249970729c
e2e-cache / Test npm (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn subprojects (20) (push) Waiting to run
e2e-cache / Test yarn subprojects (22) (push) Waiting to run
e2e-cache / Test yarn subprojects (24) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (20) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (22) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (24) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (20) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (22) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (24) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (20) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (22) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (24) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, windows-latest) (push) Waiting to run
proxy / test-proxy (push) Waiting to run
proxy / test-bypass-proxy (push) Waiting to run
versions / local-cache (20, macos-latest) (push) Waiting to run
versions / local-cache (20, macos-latest-large) (push) Waiting to run
versions / local-cache (20, ubuntu-latest) (push) Waiting to run
versions / local-cache (20, windows-latest) (push) Waiting to run
versions / local-cache (22, macos-latest) (push) Waiting to run
versions / local-cache (22, macos-latest-large) (push) Waiting to run
versions / local-cache (22, ubuntu-latest) (push) Waiting to run
versions / local-cache (22, windows-latest) (push) Waiting to run
versions / local-cache (24, macos-latest) (push) Waiting to run
versions / local-cache (24, macos-latest-large) (push) Waiting to run
versions / local-cache (24, ubuntu-latest) (push) Waiting to run
versions / local-cache (24, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/*, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/*, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/*, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/-1, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/-1, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/-1, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/dubnium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/dubnium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/dubnium, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/erbium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/erbium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/erbium, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/fermium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/fermium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/fermium, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, windows-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (20-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, windows-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, windows-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (25-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, windows-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, macos-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, macos-latest-large) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, windows-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, macos-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, macos-latest-large) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, windows-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, macos-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, macos-latest-large) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, windows-latest) (push) Waiting to run
versions / manifest (20.10.0, macos-latest) (push) Waiting to run
versions / manifest (20.10.0, macos-latest-large) (push) Waiting to run
versions / manifest (20.10.0, ubuntu-latest) (push) Waiting to run
versions / manifest (20.10.0, windows-latest) (push) Waiting to run
versions / manifest (22.0.0, macos-latest) (push) Waiting to run
versions / manifest (22.0.0, macos-latest-large) (push) Waiting to run
versions / manifest (22.0.0, ubuntu-latest) (push) Waiting to run
versions / manifest (22.0.0, windows-latest) (push) Waiting to run
versions / manifest (24.9.0, macos-latest) (push) Waiting to run
versions / manifest (24.9.0, macos-latest-large) (push) Waiting to run
versions / manifest (24.9.0, ubuntu-latest) (push) Waiting to run
versions / manifest (24.9.0, windows-latest) (push) Waiting to run
versions / check-latest (20, macos-latest) (push) Waiting to run
versions / check-latest (20, macos-latest-large) (push) Waiting to run
versions / check-latest (20, ubuntu-latest) (push) Waiting to run
versions / check-latest (20, windows-latest) (push) Waiting to run
versions / check-latest (22, macos-latest) (push) Waiting to run
versions / check-latest (22, macos-latest-large) (push) Waiting to run
versions / check-latest (22, ubuntu-latest) (push) Waiting to run
versions / check-latest (22, windows-latest) (push) Waiting to run
versions / check-latest (24, macos-latest) (push) Waiting to run
versions / check-latest (24, macos-latest-large) (push) Waiting to run
versions / check-latest (24, ubuntu-latest) (push) Waiting to run
versions / check-latest (24, windows-latest) (push) Waiting to run
versions / version-file (.nvmrc, macos-latest) (push) Waiting to run
versions / version-file (.nvmrc, macos-latest-large) (push) Waiting to run
versions / version-file (.nvmrc, ubuntu-latest) (push) Waiting to run
versions / version-file (.nvmrc, windows-latest) (push) Waiting to run
versions / version-file (.tool-versions, macos-latest) (push) Waiting to run
versions / version-file (.tool-versions, macos-latest-large) (push) Waiting to run
versions / version-file (.tool-versions, ubuntu-latest) (push) Waiting to run
versions / version-file (.tool-versions, windows-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, macos-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, macos-latest-large) (push) Waiting to run
versions / version-file (.tool-versions-node, ubuntu-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, windows-latest) (push) Waiting to run
versions / version-file (package.json, macos-latest) (push) Waiting to run
versions / version-file (package.json, macos-latest-large) (push) Waiting to run
versions / version-file (package.json, ubuntu-latest) (push) Waiting to run
versions / version-file (package.json, windows-latest) (push) Waiting to run
versions / version-file-dev-engines (macos-latest) (push) Waiting to run
versions / version-file-dev-engines (ubuntu-latest) (push) Waiting to run
versions / version-file-dev-engines (windows-latest) (push) Waiting to run
versions / version-file-volta (macos-latest) (push) Waiting to run
versions / version-file-volta (macos-latest-large) (push) Waiting to run
versions / version-file-volta (ubuntu-latest) (push) Waiting to run
versions / version-file-volta (windows-latest) (push) Waiting to run
versions / version-file-volta-extends (macos-latest) (push) Waiting to run
versions / version-file-volta-extends (macos-latest-large) (push) Waiting to run
versions / version-file-volta-extends (ubuntu-latest) (push) Waiting to run
versions / version-file-volta-extends (windows-latest) (push) Waiting to run
versions / node-dist (21, macos-latest) (push) Waiting to run
versions / node-dist (21, macos-latest-large) (push) Waiting to run
versions / node-dist (21, ubuntu-latest) (push) Waiting to run
versions / node-dist (21, windows-latest) (push) Waiting to run
versions / node-dist (23, macos-latest) (push) Waiting to run
versions / node-dist (23, macos-latest-large) (push) Waiting to run
versions / node-dist (23, ubuntu-latest) (push) Waiting to run
versions / node-dist (23, windows-latest) (push) Waiting to run
versions / old-versions (macos-latest-large) (push) Waiting to run
versions / old-versions (ubuntu-latest) (push) Waiting to run
versions / old-versions (windows-latest) (push) Waiting to run
versions / arch (push) Waiting to run
versions / node-latest-aliases (current, macos-latest) (push) Waiting to run
versions / node-latest-aliases (current, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (current, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (current, windows-latest) (push) Waiting to run
versions / node-latest-aliases (latest, macos-latest) (push) Waiting to run
versions / node-latest-aliases (latest, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (latest, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (latest, windows-latest) (push) Waiting to run
versions / node-latest-aliases (node, macos-latest) (push) Waiting to run
versions / node-latest-aliases (node, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (node, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (node, windows-latest) (push) Waiting to run
Update @actions/cache to 5.1.0 and add security overrides for undici and fast-xml-parser (#1579)
* Update @actions/cache to 5.1.0, add security overrides for undici and fast-xml-parser, update licenses

* Fix debug message for unchanged cache validation in tests

* Fix formatting in cache validation test for unchanged cache

* Bump version to 6.5.0
2026-07-13 21:48:03 -05:00

77 lines
2.5 KiB
TypeScript

import * as core from '@actions/core';
import * as cache from '@actions/cache';
import {State} from './constants';
import {getPackageManagerInfo} from './cache-utils';
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
// throw an uncaught exception. Instead of failing this action, just warn.
process.on('uncaughtException', e => {
const warningPrefix = '[warning]';
core.info(`${warningPrefix}${e.message}`);
});
// Added early exit to resolve issue with slow post action step:
export async function run(earlyExit?: boolean) {
try {
const cacheLock = core.getState(State.CachePackageManager);
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);
}
}
const cachePackages = async (packageManager: string) => {
const state = core.getState(State.CacheMatchedKey);
const primaryKey = core.getState(State.CachePrimaryKey);
const cachePaths = JSON.parse(
core.getState(State.CachePaths) || '[]'
) as string[];
const packageManagerInfo = await getPackageManagerInfo(packageManager);
if (!packageManagerInfo) {
core.debug(`Caching for '${packageManager}' is not supported`);
return;
}
if (!cachePaths.length) {
// TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?)
// export declare function getInput(name: string, options?: InputOptions): string;
const cacheDependencyPath = core.getInput('cache-dependency-path') || '';
throw new Error(
`Cache folder paths are not retrieved for ${packageManager} with cache-dependency-path = ${cacheDependencyPath}`
);
}
if (primaryKey === state) {
core.info(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
);
return;
}
const cacheId = await cache.saveCache(cachePaths, primaryKey);
if (cacheId === -1) {
// saveCache returns -1 without throwing when the cache was not saved, e.g.
// a reserve collision or a read-only token (fork PR). @actions/cache has
// already logged the reason at the appropriate severity, so just trace it.
core.debug(`Cache was not saved for the key: ${primaryKey}`);
return;
}
core.info(`Cache saved with the key: ${primaryKey}`);
};
run(true);