Skip to content

Commit

Permalink
Merge pull request #311 from actions/revert-307-v-alsvir/disable-cach…
Browse files Browse the repository at this point in the history
…e-usage-temp-v1

Revert "Temporarily disable image cache usage for v1"
  • Loading branch information
AlenaSviridenko authored Aug 4, 2021
2 parents eb41679 + 108628b commit f1f314f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 2 additions & 4 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ describe('installer tests', () => {
}
}, 100000);

// Usage of pre-cached Node.js is temporarily disabled.
xit('Uses version of node installed in cache', async () => {
it('Uses version of node installed in cache', async () => {
const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch());
await io.mkdirP(nodeDir);
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
Expand All @@ -112,8 +111,7 @@ describe('installer tests', () => {
return;
});

// Usage of pre-cached Node.js is temporarily disabled.
xit('Resolves semantic versions of node installed in cache', async () => {
it('Resolves semantic versions of node installed in cache', async () => {
const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
await io.mkdirP(nodeDir);
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
Expand Down
7 changes: 2 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12231,8 +12231,7 @@ function getNode(versionSpec) {
let toolPath;
toolPath = tc.find('node', versionSpec);
// If not found in cache, download
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
if (!toolPath) {
let version;
const c = semver.clean(versionSpec) || '';
// If explicit version
Expand All @@ -12249,8 +12248,7 @@ function getNode(versionSpec) {
// check cache
toolPath = tc.find('node', version);
}
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
if (!toolPath) {
// download, extract, cache
toolPath = yield acquireNode(version);
}
Expand Down Expand Up @@ -12344,7 +12342,6 @@ function acquireNode(version) {
let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
let downloadPath;
try {
core.info(`Downloading ${downloadUrl}`);
downloadPath = yield tc.downloadTool(downloadUrl);
}
catch (err) {
Expand Down
7 changes: 2 additions & 5 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export async function getNode(versionSpec: string) {
toolPath = tc.find('node', versionSpec);

// If not found in cache, download
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
if (!toolPath) {
let version: string;
const c = semver.clean(versionSpec) || '';
// If explicit version
Expand All @@ -46,8 +45,7 @@ export async function getNode(versionSpec: string) {
toolPath = tc.find('node', version);
}

// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
if (!toolPath) {
// download, extract, cache
toolPath = await acquireNode(version);
}
Expand Down Expand Up @@ -148,7 +146,6 @@ async function acquireNode(version: string): Promise<string> {
let downloadPath: string;

try {
core.info(`Downloading ${downloadUrl}`);
downloadPath = await tc.downloadTool(downloadUrl);
} catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
Expand Down

0 comments on commit f1f314f

Please sign in to comment.