mirror of
https://github.com/actions/setup-java.git
synced 2025-09-30 12:45:50 +00:00
Merge branch 'main' into fix/graalvm-api-rate-limit
This commit is contained in:
commit
6593b7ea10
9 changed files with 1553 additions and 1489 deletions
58
dist/setup/index.js
vendored
58
dist/setup/index.js
vendored
|
@ -129863,15 +129863,38 @@ class JavaBase {
|
|||
}
|
||||
else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
try {
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
}
|
||||
else {
|
||||
core.info('Trying to download...');
|
||||
foundJava = yield this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info('Trying to download...');
|
||||
foundJava = yield this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
catch (error) {
|
||||
if (error instanceof tc.HTTPError) {
|
||||
if (error.httpStatusCode === 403) {
|
||||
core.error('HTTP 403: Permission denied or access restricted.');
|
||||
}
|
||||
else if (error.httpStatusCode === 429) {
|
||||
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
|
||||
}
|
||||
else {
|
||||
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Java setup failed due to network issue or timeout: ${message}`);
|
||||
}
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
|
@ -130732,7 +130755,12 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||
// url is identical except page_index so print it once for debug
|
||||
core.debug(`Gathering available versions from '${rawUrl}'`);
|
||||
}
|
||||
const paginationPage = (yield this.http.getJson(rawUrl, requestHeaders)).result;
|
||||
const paginationPageResult = (yield this.http.getJson(rawUrl, requestHeaders)).result;
|
||||
if (!paginationPageResult || paginationPageResult.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
}
|
||||
const paginationPage = paginationPageResult.filter(version => this.stable ? !version.prerelease : version.prerelease);
|
||||
if (!paginationPage || paginationPage.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
|
@ -130740,9 +130768,11 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||
rawVersions.push(...paginationPage);
|
||||
page_index++;
|
||||
}
|
||||
// Add versions not available from the API but are downloadable
|
||||
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag })));
|
||||
if (this.stable) {
|
||||
// Add versions not available from the API but are downloadable
|
||||
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag, prerelease: false })));
|
||||
}
|
||||
const versions0 = rawVersions.map((v) => __awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
// Release tags look like one of these:
|
||||
|
@ -130761,7 +130791,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||
.replace('-', '');
|
||||
const vsplit = vstring.split('b');
|
||||
let semver = vsplit[0];
|
||||
const build = +vsplit[1];
|
||||
const build = vsplit[1];
|
||||
// Normalize semver
|
||||
if (!semver.includes('.') && !semver.includes('_'))
|
||||
semver = `${semver}.0.0`;
|
||||
|
@ -131245,7 +131275,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
|
|||
}
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(`Http request for microsoft-openjdk-versions.json failed with status code: ${response === null || response === void 0 ? void 0 : response.statusCode}`);
|
||||
core.debug(`Http request for microsoft-openjdk-versions.json failed with status code: ${response === null || response === void 0 ? void 0 : response.statusCode}. Error: ${err}`);
|
||||
return null;
|
||||
}
|
||||
if (response.result) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue