mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	Merge pull request #311 from actions/revert-307-v-alsvir/disable-cache-usage-temp-v1
Revert "Temporarily disable image cache usage for v1"
This commit is contained in:
		@@ -88,8 +88,7 @@ describe('installer tests', () => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }, 100000);
 | 
					  }, 100000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Usage of pre-cached Node.js is temporarily disabled.
 | 
					  it('Uses version of node installed in cache', async () => {
 | 
				
			||||||
  xit('Uses version of node installed in cache', async () => {
 | 
					 | 
				
			||||||
    const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch());
 | 
					    const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch());
 | 
				
			||||||
    await io.mkdirP(nodeDir);
 | 
					    await io.mkdirP(nodeDir);
 | 
				
			||||||
    fs.writeFileSync(`${nodeDir}.complete`, 'hello');
 | 
					    fs.writeFileSync(`${nodeDir}.complete`, 'hello');
 | 
				
			||||||
@@ -112,8 +111,7 @@ describe('installer tests', () => {
 | 
				
			|||||||
    return;
 | 
					    return;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Usage of pre-cached Node.js is temporarily disabled.
 | 
					  it('Resolves semantic versions of node installed in cache', async () => {
 | 
				
			||||||
  xit('Resolves semantic versions of node installed in cache', async () => {
 | 
					 | 
				
			||||||
    const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
 | 
					    const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
 | 
				
			||||||
    await io.mkdirP(nodeDir);
 | 
					    await io.mkdirP(nodeDir);
 | 
				
			||||||
    fs.writeFileSync(`${nodeDir}.complete`, 'hello');
 | 
					    fs.writeFileSync(`${nodeDir}.complete`, 'hello');
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -12231,8 +12231,7 @@ function getNode(versionSpec) {
 | 
				
			|||||||
        let toolPath;
 | 
					        let toolPath;
 | 
				
			||||||
        toolPath = tc.find('node', versionSpec);
 | 
					        toolPath = tc.find('node', versionSpec);
 | 
				
			||||||
        // If not found in cache, download
 | 
					        // If not found in cache, download
 | 
				
			||||||
        // Usage of pre-cached Node.js is temporarily disabled.
 | 
					        if (!toolPath) {
 | 
				
			||||||
        if (true) {
 | 
					 | 
				
			||||||
            let version;
 | 
					            let version;
 | 
				
			||||||
            const c = semver.clean(versionSpec) || '';
 | 
					            const c = semver.clean(versionSpec) || '';
 | 
				
			||||||
            // If explicit version
 | 
					            // If explicit version
 | 
				
			||||||
@@ -12249,8 +12248,7 @@ function getNode(versionSpec) {
 | 
				
			|||||||
                // check cache
 | 
					                // check cache
 | 
				
			||||||
                toolPath = tc.find('node', version);
 | 
					                toolPath = tc.find('node', version);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Usage of pre-cached Node.js is temporarily disabled.
 | 
					            if (!toolPath) {
 | 
				
			||||||
            if (true) {
 | 
					 | 
				
			||||||
                // download, extract, cache
 | 
					                // download, extract, cache
 | 
				
			||||||
                toolPath = yield acquireNode(version);
 | 
					                toolPath = yield acquireNode(version);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -12344,7 +12342,6 @@ function acquireNode(version) {
 | 
				
			|||||||
        let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
 | 
					        let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
 | 
				
			||||||
        let downloadPath;
 | 
					        let downloadPath;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            core.info(`Downloading ${downloadUrl}`);
 | 
					 | 
				
			||||||
            downloadPath = yield tc.downloadTool(downloadUrl);
 | 
					            downloadPath = yield tc.downloadTool(downloadUrl);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (err) {
 | 
					        catch (err) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,8 +25,7 @@ export async function getNode(versionSpec: string) {
 | 
				
			|||||||
  toolPath = tc.find('node', versionSpec);
 | 
					  toolPath = tc.find('node', versionSpec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // If not found in cache, download
 | 
					  // If not found in cache, download
 | 
				
			||||||
  // Usage of pre-cached Node.js is temporarily disabled.
 | 
					  if (!toolPath) {
 | 
				
			||||||
  if (true) {
 | 
					 | 
				
			||||||
    let version: string;
 | 
					    let version: string;
 | 
				
			||||||
    const c = semver.clean(versionSpec) || '';
 | 
					    const c = semver.clean(versionSpec) || '';
 | 
				
			||||||
    // If explicit version
 | 
					    // If explicit version
 | 
				
			||||||
@@ -46,8 +45,7 @@ export async function getNode(versionSpec: string) {
 | 
				
			|||||||
      toolPath = tc.find('node', version);
 | 
					      toolPath = tc.find('node', version);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Usage of pre-cached Node.js is temporarily disabled.
 | 
					    if (!toolPath) {
 | 
				
			||||||
    if (true) {
 | 
					 | 
				
			||||||
      // download, extract, cache
 | 
					      // download, extract, cache
 | 
				
			||||||
      toolPath = await acquireNode(version);
 | 
					      toolPath = await acquireNode(version);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -148,7 +146,6 @@ async function acquireNode(version: string): Promise<string> {
 | 
				
			|||||||
  let downloadPath: string;
 | 
					  let downloadPath: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    core.info(`Downloading ${downloadUrl}`);
 | 
					 | 
				
			||||||
    downloadPath = await tc.downloadTool(downloadUrl);
 | 
					    downloadPath = await tc.downloadTool(downloadUrl);
 | 
				
			||||||
  } catch (err) {
 | 
					  } catch (err) {
 | 
				
			||||||
    if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
 | 
					    if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user