mirror of
https://github.com/actions/setup-java.git
synced 2026-06-17 00:45:55 +00:00
Add 1000-page safeguard to Adopt Temurin and Semeru pagination
This commit is contained in:
parent
3b472a4e31
commit
870106f694
27
dist/setup/index.js
vendored
27
dist/setup/index.js
vendored
@ -77569,6 +77569,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
const semver_1 = __importDefault(__nccwpck_require__(11383));
|
||||
const base_installer_1 = __nccwpck_require__(59741);
|
||||
const util_1 = __nccwpck_require__(92629);
|
||||
const MAX_PAGINATION_PAGES = 1000;
|
||||
var AdoptImplementation;
|
||||
(function (AdoptImplementation) {
|
||||
AdoptImplementation["Hotspot"] = "Hotspot";
|
||||
@ -77653,10 +77654,12 @@ class AdoptDistribution extends base_installer_1.JavaBase {
|
||||
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||
let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||
const availableVersions = [];
|
||||
let pageCount = 0;
|
||||
if (core.isDebug()) {
|
||||
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||
}
|
||||
while (availableVersionsUrl) {
|
||||
pageCount++;
|
||||
const response = yield this.http.getJson(availableVersionsUrl);
|
||||
const paginationPage = response.result;
|
||||
availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers);
|
||||
@ -77664,6 +77667,10 @@ class AdoptDistribution extends base_installer_1.JavaBase {
|
||||
break;
|
||||
}
|
||||
availableVersions.push(...paginationPage);
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Adopt releases.`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
@ -78728,7 +78735,6 @@ const semver_1 = __importDefault(__nccwpck_require__(11383));
|
||||
const base_installer_1 = __nccwpck_require__(59741);
|
||||
const util_1 = __nccwpck_require__(92629);
|
||||
const http_client_1 = __nccwpck_require__(96255);
|
||||
const MAX_PAGINATION_PAGES = 1000;
|
||||
class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
constructor(installerOptions) {
|
||||
super('JetBrains', installerOptions);
|
||||
@ -78781,7 +78787,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
let page_index = 1;
|
||||
const rawVersions = [];
|
||||
const bearerToken = process.env.GITHUB_TOKEN;
|
||||
while (page_index <= MAX_PAGINATION_PAGES) {
|
||||
while (true) {
|
||||
const requestArguments = `per_page=100&page=${page_index}`;
|
||||
const requestHeaders = {};
|
||||
if (bearerToken) {
|
||||
@ -78805,9 +78811,6 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
rawVersions.push(...paginationPage);
|
||||
page_index++;
|
||||
}
|
||||
if (page_index > MAX_PAGINATION_PAGES) {
|
||||
core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing JetBrains runtime releases.`);
|
||||
}
|
||||
if (this.stable) {
|
||||
// Add versions not available from the API but are downloadable
|
||||
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||
@ -79730,6 +79733,7 @@ const core = __importStar(__nccwpck_require__(42186));
|
||||
const tc = __importStar(__nccwpck_require__(27784));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
const MAX_PAGINATION_PAGES = 1000;
|
||||
const supportedArchitectures = [
|
||||
'x64',
|
||||
'x86',
|
||||
@ -79828,10 +79832,12 @@ class SemeruDistribution extends base_installer_1.JavaBase {
|
||||
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||
let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||
const availableVersions = [];
|
||||
let pageCount = 0;
|
||||
if (core.isDebug()) {
|
||||
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||
}
|
||||
while (availableVersionsUrl) {
|
||||
pageCount++;
|
||||
const response = yield this.http.getJson(availableVersionsUrl);
|
||||
const paginationPage = response.result;
|
||||
availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers);
|
||||
@ -79839,6 +79845,10 @@ class SemeruDistribution extends base_installer_1.JavaBase {
|
||||
break;
|
||||
}
|
||||
availableVersions.push(...paginationPage);
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Semeru releases.`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
@ -79916,6 +79926,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
const semver_1 = __importDefault(__nccwpck_require__(11383));
|
||||
const base_installer_1 = __nccwpck_require__(59741);
|
||||
const util_1 = __nccwpck_require__(92629);
|
||||
const MAX_PAGINATION_PAGES = 1000;
|
||||
var TemurinImplementation;
|
||||
(function (TemurinImplementation) {
|
||||
TemurinImplementation["Hotspot"] = "Hotspot";
|
||||
@ -79998,10 +80009,12 @@ class TemurinDistribution extends base_installer_1.JavaBase {
|
||||
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||
let availableVersionsUrl = `https://api.adoptium.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||
const availableVersions = [];
|
||||
let pageCount = 0;
|
||||
if (core.isDebug()) {
|
||||
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||
}
|
||||
while (availableVersionsUrl) {
|
||||
pageCount++;
|
||||
const response = yield this.http.getJson(availableVersionsUrl);
|
||||
const paginationPage = response.result;
|
||||
availableVersionsUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers);
|
||||
@ -80009,6 +80022,10 @@ class TemurinDistribution extends base_installer_1.JavaBase {
|
||||
break;
|
||||
}
|
||||
availableVersions.push(...paginationPage);
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Temurin releases.`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
|
||||
@ -148,7 +148,7 @@ export class AdoptDistribution extends JavaBase {
|
||||
|
||||
availableVersions.push(...paginationPage);
|
||||
|
||||
if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) {
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(
|
||||
`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Adopt releases.`
|
||||
);
|
||||
|
||||
@ -179,7 +179,7 @@ export class SemeruDistribution extends JavaBase {
|
||||
|
||||
availableVersions.push(...paginationPage);
|
||||
|
||||
if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) {
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(
|
||||
`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Semeru releases.`
|
||||
);
|
||||
|
||||
@ -148,7 +148,7 @@ export class TemurinDistribution extends JavaBase {
|
||||
|
||||
availableVersions.push(...paginationPage);
|
||||
|
||||
if (pageCount >= MAX_PAGINATION_PAGES && availableVersionsUrl) {
|
||||
if (pageCount >= MAX_PAGINATION_PAGES) {
|
||||
core.warning(
|
||||
`Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing Temurin releases.`
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user