mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-11-05 19:45:48 +00:00
work on resolving comments
This commit is contained in:
parent
f2b87bb2c2
commit
d36a3314a5
9 changed files with 10 additions and 10 deletions
|
@ -4,7 +4,7 @@
|
||||||
<a href="https://github.com/actions/setup-node/actions?query=workflow%3Abuild-test"><img alt="build-test status" src="https://github.com/actions/setup-node/workflows/build-test/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aversions"><img alt="versions status" src="https://github.com/actions/setup-node/workflows/versions/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aproxy"><img alt="proxy status" src="https://github.com/actions/setup-node/workflows/proxy/badge.svg"></a>
|
<a href="https://github.com/actions/setup-node/actions?query=workflow%3Abuild-test"><img alt="build-test status" src="https://github.com/actions/setup-node/workflows/build-test/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aversions"><img alt="versions status" src="https://github.com/actions/setup-node/workflows/versions/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aproxy"><img alt="proxy status" src="https://github.com/actions/setup-node/workflows/proxy/badge.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
This action provides the following functionality for GitHub Actions runners:
|
This action provides the following functionality for GitHub Actions users:
|
||||||
|
|
||||||
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
|
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
|
||||||
- Optionally caching npm/yarn dependencies
|
- Optionally caching npm/yarn dependencies
|
||||||
|
|
|
@ -126,7 +126,7 @@ describe('cache-restore', () => {
|
||||||
await restoreCache(packageManager);
|
await restoreCache(packageManager);
|
||||||
expect(hashFilesSpy).toHaveBeenCalled();
|
expect(hashFilesSpy).toHaveBeenCalled();
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
`Cache restored from key: ${platform}-${packageManager}-${fileHash}`
|
`Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}`
|
||||||
);
|
);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
`${packageManager} cache is not found`
|
`${packageManager} cache is not found`
|
||||||
|
|
|
@ -20,7 +20,7 @@ inputs:
|
||||||
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
|
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
cache:
|
cache:
|
||||||
description: 'Used to specify package manager for caching in default directory. Supported values: npm, yarn'
|
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn'
|
||||||
# TODO: add input to control forcing to pull from cloud or dist.
|
# TODO: add input to control forcing to pull from cloud or dist.
|
||||||
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
|
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
|
||||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
|
|
2
dist/cache-save/index.js
vendored
2
dist/cache-save/index.js
vendored
|
@ -50583,8 +50583,8 @@ const constants_1 = __webpack_require__(196);
|
||||||
const cache_utils_1 = __webpack_require__(452);
|
const cache_utils_1 = __webpack_require__(452);
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const cacheLock = core.getInput('cache');
|
|
||||||
try {
|
try {
|
||||||
|
const cacheLock = core.getInput('cache');
|
||||||
yield cachePackages(cacheLock);
|
yield cachePackages(cacheLock);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -42732,7 +42732,7 @@ exports.restoreCache = (packageManager) => __awaiter(void 0, void 0, void 0, fun
|
||||||
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
||||||
const lockFilePath = findLockFile(packageManagerInfo);
|
const lockFilePath = findLockFile(packageManagerInfo);
|
||||||
const fileHash = yield glob.hashFiles(lockFilePath);
|
const fileHash = yield glob.hashFiles(lockFilePath);
|
||||||
const primaryKey = `${platform}-${packageManager}-${fileHash}`;
|
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
||||||
const cacheKey = yield cache.restoreCache([cachePath], primaryKey);
|
const cacheKey = yield cache.restoreCache([cachePath], primaryKey);
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const restoreCache = async (packageManager: string) => {
|
||||||
const lockFilePath = findLockFile(packageManagerInfo);
|
const lockFilePath = findLockFile(packageManagerInfo);
|
||||||
const fileHash = await glob.hashFiles(lockFilePath);
|
const fileHash = await glob.hashFiles(lockFilePath);
|
||||||
|
|
||||||
const primaryKey = `${platform}-${packageManager}-${fileHash}`;
|
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
|
|
||||||
core.saveState(State.CachePrimaryKey, primaryKey);
|
core.saveState(State.CachePrimaryKey, primaryKey);
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {State} from './constants';
|
||||||
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
const cacheLock = core.getInput('cache');
|
|
||||||
try {
|
try {
|
||||||
|
const cacheLock = core.getInput('cache');
|
||||||
await cachePackages(cacheLock);
|
await cachePackages(cacheLock);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|
Loading…
Reference in a new issue