Compare commits

..

1 Commits

Author SHA1 Message Date
600cfee239 Update util.ts 2022-03-31 20:54:55 +05:30
17 changed files with 4664 additions and 7610 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -139,7 +139,6 @@ describe('findPackageForDownload', () => {
packageType: 'jdk', packageType: 'jdk',
checkLatest: false checkLatest: false
}); });
distribution['getAvailableVersions'] = async () => manifestData;
await expect( await expect(
distribution['findPackageForDownload'](distribution['version']) distribution['findPackageForDownload'](distribution['version'])
).rejects.toThrowError(/Could not find satisfied version for semver */); ).rejects.toThrowError(/Could not find satisfied version for semver */);

View File

@ -1,9 +1,4 @@
import * as cache from '@actions/cache'; import { isVersionSatisfies } from '../src/util';
import * as core from '@actions/core';
import { isVersionSatisfies, isCacheFeatureAvailable } from '../src/util';
jest.mock('@actions/cache');
jest.mock('@actions/core');
describe('isVersionSatisfies', () => { describe('isVersionSatisfies', () => {
it.each([ it.each([
@ -25,38 +20,3 @@ describe('isVersionSatisfies', () => {
expect(actual).toBe(expected); expect(actual).toBe(expected);
}); });
}); });
describe('isCacheFeatureAvailable', () => {
it('isCacheFeatureAvailable disabled on GHES', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
try {
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
isCacheFeatureAvailable();
} catch (error) {
expect(error).toHaveProperty(
'message',
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
);
} finally {
delete process.env['GITHUB_SERVER_URL'];
}
});
it('isCacheFeatureAvailable disabled on dotcom', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
const infoMock = jest.spyOn(core, 'warning');
const message = 'The runner was not able to contact the cache service. Caching will be skipped';
try {
process.env['GITHUB_SERVER_URL'] = 'http://github.com';
expect(isCacheFeatureAvailable()).toBe(false);
expect(infoMock).toHaveBeenCalledWith(message);
} finally {
delete process.env['GITHUB_SERVER_URL'];
}
});
it('isCacheFeatureAvailable is enabled', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => true);
expect(isCacheFeatureAvailable()).toBe(true);
});
});

5750
dist/cleanup/index.js vendored

File diff suppressed because it is too large Load Diff

6304
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

145
package-lock.json generated
View File

@ -1,15 +1,15 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "3.1.1", "version": "2.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-java", "name": "setup-java",
"version": "3.1.1", "version": "2.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^2.0.2", "@actions/cache": "^1.0.8",
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/glob": "^0.2.0", "@actions/glob": "^0.2.0",
@ -32,17 +32,17 @@
} }
}, },
"node_modules/@actions/cache": { "node_modules/@actions/cache": {
"version": "2.0.2", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.8.tgz",
"integrity": "sha512-K1DCaW/OtHj5mV7hI7HEXiceX3rM4Nc0iG2hfYsrkEy6GiOeqlCC/LyICrBZIRDM6+vSrS12tg1ORl4hghomBA==", "integrity": "sha512-GWNNB67w93HGJRQXlsV56YqrdAuDoP3esK/mo5mzU8WoDCVjtQgJGsTdkYUX7brswtT7xnI30bWNo1WLKQ8FZQ==",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0", "@actions/glob": "^0.1.0",
"@actions/http-client": "^1.0.9", "@actions/http-client": "^1.0.9",
"@actions/io": "^1.0.1", "@actions/io": "^1.0.1",
"@azure/ms-rest-js": "^2.6.0", "@azure/ms-rest-js": "^2.0.7",
"@azure/storage-blob": "^12.8.0", "@azure/storage-blob": "^12.1.2",
"semver": "^6.1.0", "semver": "^6.1.0",
"uuid": "^3.3.3" "uuid": "^3.3.3"
} }
@ -137,12 +137,9 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"node_modules/@azure/core-asynciterator-polyfill": { "node_modules/@azure/core-asynciterator-polyfill": {
"version": "1.0.2", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0.tgz",
"integrity": "sha512-3rkP4LnnlWawl0LZptJOdXNrT/fHp2eQMadoasa6afspXdpGrtPZuAQc2PD0cpgyuoXtUWyC3tv7xfntjGS5Dw==", "integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg=="
"engines": {
"node": ">=12.0.0"
}
}, },
"node_modules/@azure/core-auth": { "node_modules/@azure/core-auth": {
"version": "1.3.2", "version": "1.3.2",
@ -162,9 +159,9 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"node_modules/@azure/core-http": { "node_modules/@azure/core-http": {
"version": "2.2.4", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.4.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.2.tgz",
"integrity": "sha512-QmmJmexXKtPyc3/rsZR/YTLDvMatzbzAypJmLzvlfxgz/SkgnqV/D4f6F2LsK6tBj1qhyp8BoXiOebiej0zz3A==", "integrity": "sha512-V1DdoO9V/sFimKpdWoNBgsE+QUjQgpXYnxrTdUp5RyhsTJjvEVn/HKmTQXIHuLUUo6IyIWj+B+Dg4VaXse9dIA==",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0",
@ -174,7 +171,7 @@
"@types/node-fetch": "^2.5.0", "@types/node-fetch": "^2.5.0",
"@types/tunnel": "^0.0.3", "@types/tunnel": "^0.0.3",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.0",
"process": "^0.11.10", "process": "^0.11.10",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"tslib": "^2.2.0", "tslib": "^2.2.0",
@ -226,9 +223,9 @@
} }
}, },
"node_modules/@azure/core-lro": { "node_modules/@azure/core-lro": {
"version": "2.2.4", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.4.tgz", "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.1.tgz",
"integrity": "sha512-e1I2v2CZM0mQo8+RSix0x091Av493e4bnT22ds2fcQGslTHzM2oTbswkB65nP4iEpCxBrFxOSDPKExmTmjCVtQ==", "integrity": "sha512-HE6PBl+mlKa0eBsLwusHqAqjLc5n9ByxeDo3Hz4kF3B1hqHvRkBr4oMgoT6tX7Hc3q97KfDctDUon7EhvoeHPA==",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.13", "@azure/core-tracing": "1.0.0-preview.13",
@ -245,9 +242,9 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"node_modules/@azure/core-paging": { "node_modules/@azure/core-paging": {
"version": "1.2.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.0.tgz",
"integrity": "sha512-UtH5iMlYsvg+nQYIl4UHlvvSrsBjOlRF4fs0j7mxd3rWdAStrKYrh2durOpHs5C9yZbVhsVDaisoyaf/lL1EVA==", "integrity": "sha512-ZX1bCjm/MjKPCN6kQD/9GJErYSoKA8YWp6YWoo5EIzcTWlSBLXu3gNaBTUl8usGl+UShiKo7b4Gdy1NSTIlpZg==",
"dependencies": { "dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0",
"tslib": "^2.2.0" "tslib": "^2.2.0"
@ -295,14 +292,14 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"node_modules/@azure/ms-rest-js": { "node_modules/@azure/ms-rest-js": {
"version": "2.6.1", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.1.tgz", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.0.tgz",
"integrity": "sha512-LLi4jRe/qy5IM8U2CkoDgSZp2OH+MgDe2wePmhz8uY84Svc53EhHaamVyoU6BjjHBxvCRh1vcD1urJDccrxqIw==", "integrity": "sha512-4C5FCtvEzWudblB+h92/TYYPiq7tuElX8icVYToxOdggnYqeec4Se14mjse5miInKtZahiFHdl8lZA/jziEc5g==",
"dependencies": { "dependencies": {
"@azure/core-auth": "^1.1.4", "@azure/core-auth": "^1.1.4",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.5.0", "form-data": "^2.5.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.0",
"tough-cookie": "^3.0.1", "tough-cookie": "^3.0.1",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
@ -332,9 +329,9 @@
} }
}, },
"node_modules/@azure/storage-blob": { "node_modules/@azure/storage-blob": {
"version": "12.9.0", "version": "12.8.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.9.0.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.8.0.tgz",
"integrity": "sha512-ank38FdCLfJ+EoeMzCz3hkYJuZAd63ARvDKkxZYRDb+beBYf+/+gx8jNTqkq/hfyUl4dJQ/a7tECU0Y0F98CHg==", "integrity": "sha512-c8+Wz19xauW0bGkTCoqZH4dYfbtBniPiGiRQOn1ca6G5jsjr4azwaTk9gwjVY8r3vY2Taf95eivLzipfIfiS4A==",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^2.0.0", "@azure/core-http": "^2.0.0",
@ -1720,9 +1717,9 @@
} }
}, },
"node_modules/@opentelemetry/api": { "node_modules/@opentelemetry/api": {
"version": "1.0.4", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.3.tgz",
"integrity": "sha512-BuJuXRSJNQ3QoKA6GWWDyuLpOUck+9hAXNMCnrloc1aWVoy6Xq6t9PUV08aBZ4Lutqq2LEHM486bpZqoViScog==", "integrity": "sha512-puWxACExDe9nxbBB3lOymQFrLYml2dVOrd7USiVRnSbgXE+KwBu+HxFvxrzfqsiSda9IWsXJG1ef7C1O2/GmKQ==",
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=8.0.0"
} }
@ -1844,9 +1841,9 @@
"integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ==" "integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ=="
}, },
"node_modules/@types/node-fetch": { "node_modules/@types/node-fetch": {
"version": "2.6.1", "version": "2.5.12",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz",
"integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==",
"dependencies": { "dependencies": {
"@types/node": "*", "@types/node": "*",
"form-data": "^3.0.0" "form-data": "^3.0.0"
@ -5560,9 +5557,9 @@
} }
}, },
"node_modules/minimist": { "node_modules/minimist": {
"version": "1.2.6", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
}, },
"node_modules/ms": { "node_modules/ms": {
@ -6665,17 +6662,17 @@
}, },
"dependencies": { "dependencies": {
"@actions/cache": { "@actions/cache": {
"version": "2.0.2", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.8.tgz",
"integrity": "sha512-K1DCaW/OtHj5mV7hI7HEXiceX3rM4Nc0iG2hfYsrkEy6GiOeqlCC/LyICrBZIRDM6+vSrS12tg1ORl4hghomBA==", "integrity": "sha512-GWNNB67w93HGJRQXlsV56YqrdAuDoP3esK/mo5mzU8WoDCVjtQgJGsTdkYUX7brswtT7xnI30bWNo1WLKQ8FZQ==",
"requires": { "requires": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0", "@actions/glob": "^0.1.0",
"@actions/http-client": "^1.0.9", "@actions/http-client": "^1.0.9",
"@actions/io": "^1.0.1", "@actions/io": "^1.0.1",
"@azure/ms-rest-js": "^2.6.0", "@azure/ms-rest-js": "^2.0.7",
"@azure/storage-blob": "^12.8.0", "@azure/storage-blob": "^12.1.2",
"semver": "^6.1.0", "semver": "^6.1.0",
"uuid": "^3.3.3" "uuid": "^3.3.3"
}, },
@ -6767,9 +6764,9 @@
} }
}, },
"@azure/core-asynciterator-polyfill": { "@azure/core-asynciterator-polyfill": {
"version": "1.0.2", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0.tgz",
"integrity": "sha512-3rkP4LnnlWawl0LZptJOdXNrT/fHp2eQMadoasa6afspXdpGrtPZuAQc2PD0cpgyuoXtUWyC3tv7xfntjGS5Dw==" "integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg=="
}, },
"@azure/core-auth": { "@azure/core-auth": {
"version": "1.3.2", "version": "1.3.2",
@ -6788,9 +6785,9 @@
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "2.2.4", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.4.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.2.tgz",
"integrity": "sha512-QmmJmexXKtPyc3/rsZR/YTLDvMatzbzAypJmLzvlfxgz/SkgnqV/D4f6F2LsK6tBj1qhyp8BoXiOebiej0zz3A==", "integrity": "sha512-V1DdoO9V/sFimKpdWoNBgsE+QUjQgpXYnxrTdUp5RyhsTJjvEVn/HKmTQXIHuLUUo6IyIWj+B+Dg4VaXse9dIA==",
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0",
@ -6800,7 +6797,7 @@
"@types/node-fetch": "^2.5.0", "@types/node-fetch": "^2.5.0",
"@types/tunnel": "^0.0.3", "@types/tunnel": "^0.0.3",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.0",
"process": "^0.11.10", "process": "^0.11.10",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"tslib": "^2.2.0", "tslib": "^2.2.0",
@ -6842,9 +6839,9 @@
} }
}, },
"@azure/core-lro": { "@azure/core-lro": {
"version": "2.2.4", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.4.tgz", "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.1.tgz",
"integrity": "sha512-e1I2v2CZM0mQo8+RSix0x091Av493e4bnT22ds2fcQGslTHzM2oTbswkB65nP4iEpCxBrFxOSDPKExmTmjCVtQ==", "integrity": "sha512-HE6PBl+mlKa0eBsLwusHqAqjLc5n9ByxeDo3Hz4kF3B1hqHvRkBr4oMgoT6tX7Hc3q97KfDctDUon7EhvoeHPA==",
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.13", "@azure/core-tracing": "1.0.0-preview.13",
@ -6860,9 +6857,9 @@
} }
}, },
"@azure/core-paging": { "@azure/core-paging": {
"version": "1.2.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.0.tgz",
"integrity": "sha512-UtH5iMlYsvg+nQYIl4UHlvvSrsBjOlRF4fs0j7mxd3rWdAStrKYrh2durOpHs5C9yZbVhsVDaisoyaf/lL1EVA==", "integrity": "sha512-ZX1bCjm/MjKPCN6kQD/9GJErYSoKA8YWp6YWoo5EIzcTWlSBLXu3gNaBTUl8usGl+UShiKo7b4Gdy1NSTIlpZg==",
"requires": { "requires": {
"@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0",
"tslib": "^2.2.0" "tslib": "^2.2.0"
@ -6907,14 +6904,14 @@
} }
}, },
"@azure/ms-rest-js": { "@azure/ms-rest-js": {
"version": "2.6.1", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.1.tgz", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.0.tgz",
"integrity": "sha512-LLi4jRe/qy5IM8U2CkoDgSZp2OH+MgDe2wePmhz8uY84Svc53EhHaamVyoU6BjjHBxvCRh1vcD1urJDccrxqIw==", "integrity": "sha512-4C5FCtvEzWudblB+h92/TYYPiq7tuElX8icVYToxOdggnYqeec4Se14mjse5miInKtZahiFHdl8lZA/jziEc5g==",
"requires": { "requires": {
"@azure/core-auth": "^1.1.4", "@azure/core-auth": "^1.1.4",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.5.0", "form-data": "^2.5.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.0",
"tough-cookie": "^3.0.1", "tough-cookie": "^3.0.1",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
@ -6940,9 +6937,9 @@
} }
}, },
"@azure/storage-blob": { "@azure/storage-blob": {
"version": "12.9.0", "version": "12.8.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.9.0.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.8.0.tgz",
"integrity": "sha512-ank38FdCLfJ+EoeMzCz3hkYJuZAd63ARvDKkxZYRDb+beBYf+/+gx8jNTqkq/hfyUl4dJQ/a7tECU0Y0F98CHg==", "integrity": "sha512-c8+Wz19xauW0bGkTCoqZH4dYfbtBniPiGiRQOn1ca6G5jsjr4azwaTk9gwjVY8r3vY2Taf95eivLzipfIfiS4A==",
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^2.0.0", "@azure/core-http": "^2.0.0",
@ -8043,9 +8040,9 @@
"integrity": "sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==" "integrity": "sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ=="
}, },
"@opentelemetry/api": { "@opentelemetry/api": {
"version": "1.0.4", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.3.tgz",
"integrity": "sha512-BuJuXRSJNQ3QoKA6GWWDyuLpOUck+9hAXNMCnrloc1aWVoy6Xq6t9PUV08aBZ4Lutqq2LEHM486bpZqoViScog==" "integrity": "sha512-puWxACExDe9nxbBB3lOymQFrLYml2dVOrd7USiVRnSbgXE+KwBu+HxFvxrzfqsiSda9IWsXJG1ef7C1O2/GmKQ=="
}, },
"@sinonjs/commons": { "@sinonjs/commons": {
"version": "1.8.3", "version": "1.8.3",
@ -8161,9 +8158,9 @@
"integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ==" "integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ=="
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.6.1", "version": "2.5.12",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz",
"integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==",
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
"form-data": "^3.0.0" "form-data": "^3.0.0"
@ -11063,9 +11060,9 @@
} }
}, },
"minimist": { "minimist": {
"version": "1.2.6", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
}, },
"ms": { "ms": {

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "3.1.1", "version": "2.0.0",
"private": true, "private": true,
"description": "setup java action", "description": "setup java action",
"main": "dist/setup/index.js", "main": "dist/setup/index.js",
@ -24,7 +24,7 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^2.0.2", "@actions/cache": "^1.0.8",
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/glob": "^0.2.0", "@actions/glob": "^0.2.0",

View File

@ -1,6 +1,6 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as auth from './auth'; import * as auth from './auth';
import { getBooleanInput, isCacheFeatureAvailable } from './util'; import { getBooleanInput } from './util';
import * as constants from './constants'; import * as constants from './constants';
import { restore } from './cache'; import { restore } from './cache';
import * as path from 'path'; import * as path from 'path';
@ -42,7 +42,7 @@ async function run() {
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`); core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
await auth.configureAuthentication(); await auth.configureAuthentication();
if (cache && isCacheFeatureAvailable()) { if (cache) {
await restore(cache); await restore(cache);
} }
} catch (error) { } catch (error) {

View File

@ -2,7 +2,6 @@ import os from 'os';
import path from 'path'; import path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import * as semver from 'semver'; import * as semver from 'semver';
import * as cache from '@actions/cache';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
@ -52,7 +51,7 @@ export function getDownloadArchiveExtension() {
export function isVersionSatisfies(range: string, version: string): boolean { export function isVersionSatisfies(range: string, version: string): boolean {
if (semver.valid(range)) { if (semver.valid(range)) {
// if full version with build digit is provided as a range (such as '1.2.3+4') // if full version with build digit is provided as a range (such as '1.2.3+4')
// we should check for exact equal via compareBuild // Tes we should check for exact equal via compareBuild
// since semver.satisfies doesn't handle 4th digit // since semver.satisfies doesn't handle 4th digit
const semRange = semver.parse(range); const semRange = semver.parse(range);
if (semRange && semRange.build?.length > 0) { if (semRange && semRange.build?.length > 0) {
@ -78,24 +77,3 @@ export function isJobStatusSuccess() {
return jobStatus === 'success'; return jobStatus === 'success';
} }
export function isGhes(): boolean {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
export function isCacheFeatureAvailable(): boolean {
if (!cache.isFeatureAvailable()) {
if (isGhes()) {
throw new Error(
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
);
} else {
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
}
return false;
}
return true;
}