Skip to content

Commit f1f314f

Browse files
Merge pull request actions#311 from actions/revert-307-v-alsvir/disable-cache-usage-temp-v1
Revert "Temporarily disable image cache usage for v1"
2 parents eb41679 + 108628b commit f1f314f

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

__tests__/installer.test.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ describe('installer tests', () => {
8888
}
8989
}, 100000);
9090

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

115-
// Usage of pre-cached Node.js is temporarily disabled.
116-
xit('Resolves semantic versions of node installed in cache', async () => {
114+
it('Resolves semantic versions of node installed in cache', async () => {
117115
const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
118116
await io.mkdirP(nodeDir);
119117
fs.writeFileSync(`${nodeDir}.complete`, 'hello');

dist/index.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -12231,8 +12231,7 @@ function getNode(versionSpec) {
1223112231
let toolPath;
1223212232
toolPath = tc.find('node', versionSpec);
1223312233
// If not found in cache, download
12234-
// Usage of pre-cached Node.js is temporarily disabled.
12235-
if (true) {
12234+
if (!toolPath) {
1223612235
let version;
1223712236
const c = semver.clean(versionSpec) || '';
1223812237
// If explicit version
@@ -12249,8 +12248,7 @@ function getNode(versionSpec) {
1224912248
// check cache
1225012249
toolPath = tc.find('node', version);
1225112250
}
12252-
// Usage of pre-cached Node.js is temporarily disabled.
12253-
if (true) {
12251+
if (!toolPath) {
1225412252
// download, extract, cache
1225512253
toolPath = yield acquireNode(version);
1225612254
}
@@ -12344,7 +12342,6 @@ function acquireNode(version) {
1234412342
let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
1234512343
let downloadPath;
1234612344
try {
12347-
core.info(`Downloading ${downloadUrl}`);
1234812345
downloadPath = yield tc.downloadTool(downloadUrl);
1234912346
}
1235012347
catch (err) {

src/installer.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export async function getNode(versionSpec: string) {
2525
toolPath = tc.find('node', versionSpec);
2626

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

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

150148
try {
151-
core.info(`Downloading ${downloadUrl}`);
152149
downloadPath = await tc.downloadTool(downloadUrl);
153150
} catch (err) {
154151
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {

0 commit comments

Comments
 (0)