mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 05:19:11 +08:00 
			
		
		
		
	work on resolving comments
This commit is contained in:
		@@ -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> 
 | 
			
		||||
</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 caching npm/yarn dependencies
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ describe('cache-restore', () => {
 | 
			
		||||
        await restoreCache(packageManager);
 | 
			
		||||
        expect(hashFilesSpy).toHaveBeenCalled();
 | 
			
		||||
        expect(infoSpy).toHaveBeenCalledWith(
 | 
			
		||||
          `Cache restored from key: ${platform}-${packageManager}-${fileHash}`
 | 
			
		||||
          `Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}`
 | 
			
		||||
        );
 | 
			
		||||
        expect(infoSpy).not.toHaveBeenCalledWith(
 | 
			
		||||
          `${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.
 | 
			
		||||
    default: ${{ github.token }}
 | 
			
		||||
  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. 
 | 
			
		||||
#       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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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);
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        const cacheLock = core.getInput('cache');
 | 
			
		||||
        try {
 | 
			
		||||
            const cacheLock = core.getInput('cache');
 | 
			
		||||
            yield cachePackages(cacheLock);
 | 
			
		||||
        }
 | 
			
		||||
        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 lockFilePath = findLockFile(packageManagerInfo);
 | 
			
		||||
    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.saveState(constants_1.State.CachePrimaryKey, primaryKey);
 | 
			
		||||
    const cacheKey = yield cache.restoreCache([cachePath], primaryKey);
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ export const restoreCache = async (packageManager: string) => {
 | 
			
		||||
  const lockFilePath = findLockFile(packageManagerInfo);
 | 
			
		||||
  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.saveState(State.CachePrimaryKey, primaryKey);
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ import {State} from './constants';
 | 
			
		||||
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
 | 
			
		||||
 | 
			
		||||
export async function run() {
 | 
			
		||||
  const cacheLock = core.getInput('cache');
 | 
			
		||||
  try {
 | 
			
		||||
    const cacheLock = core.getInput('cache');
 | 
			
		||||
    await cachePackages(cacheLock);
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    core.setFailed(error.message);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user