Compare commits

...

4 Commits

Author SHA1 Message Date
dependabot[bot]
55dab9d4f9 Bump @types/node from 20.11.24 to 24.0.10
---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.0.10
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-07 04:28:47 +00:00
Priya Gupta
67aec007b3 Fix: prevent default installation of JetBrains pre-releases (#859)
* fix: prevent default installation of JetBrains pre-releases

* simplify prerelease filter logic

* fix basic validation checks
2025-07-03 12:03:51 -05:00
gowridurgad
ebb356cc4e Improve Error Handling for Setup-Java Action to Help Debug Intermittent Failures (#848)
* error-handling

* Logic update

---------

Co-authored-by: “gowridurgad” <“hgowridurgad@github.com>
2025-06-23 12:32:03 -05:00
Haritha
f4f1212c88 Update publish-immutable-actions.yml (#798) 2025-04-16 11:13:56 -05:00
9 changed files with 1558 additions and 1493 deletions

View File

@@ -2,7 +2,8 @@ name: 'Publish Immutable Action Version'
on:
release:
types: [published]
types: [released]
workflow_dispatch:
jobs:
publish:

File diff suppressed because it is too large Load Diff

View File

@@ -41,9 +41,7 @@ describe('getAvailableVersions', () => {
expect(availableVersions).not.toBeNull();
const length =
os.platform() === 'win32'
? manifestData.length - 1
: manifestData.length + 1;
os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
expect(availableVersions.length).toBe(length);
}, 10_000);
});

36
dist/setup/index.js vendored
View File

@@ -128793,6 +128793,7 @@ class JavaBase {
}
else {
core.info('Trying to resolve the latest version from remote');
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) {
@@ -128804,6 +128805,28 @@ class JavaBase {
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
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
@@ -129672,7 +129695,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;
@@ -129680,9 +129708,11 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
rawVersions.push(...paginationPage);
page_index++;
}
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 })));
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:
@@ -129701,7 +129731,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`;

16
package-lock.json generated
View File

@@ -21,7 +21,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^20.11.24",
"@types/node": "^24.0.10",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
@@ -1645,11 +1645,11 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.11.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",
"integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==",
"version": "24.0.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.10.tgz",
"integrity": "sha512-ENHwaH+JIRTDIEEbDK6QSQntAYGtbvdDXnMXnZaZ6k13Du1dPMmprkEHIL7ok2Wl2aZevetwTAb5S+7yIF+enA==",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~7.8.0"
}
},
"node_modules/@types/node-fetch": {
@@ -5347,9 +5347,9 @@
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="
},
"node_modules/update-browserslist-db": {
"version": "1.0.13",

View File

@@ -38,7 +38,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^20.11.24",
"@types/node": "^24.0.10",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",

View File

@@ -51,6 +51,7 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else {
core.info('Trying to resolve the latest version from remote');
try {
const javaRelease = await this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
if (foundJava?.version === javaRelease.version) {
@@ -60,6 +61,27 @@ export abstract class JavaBase {
foundJava = await this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
} catch (error: any) {
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

View File

@@ -113,9 +113,18 @@ export class JetBrainsDistribution extends JavaBase {
core.debug(`Gathering available versions from '${rawUrl}'`);
}
const paginationPage = (
const paginationPageResult = (
await this.http.getJson<IJetBrainsRawVersion[]>(rawUrl, requestHeaders)
).result;
if (!paginationPageResult || paginationPageResult.length === 0) {
// break infinity loop because we have reached end of pagination
break;
}
const paginationPage: IJetBrainsRawVersion[] =
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;
@@ -125,9 +134,13 @@ export class JetBrainsDistribution extends JavaBase {
page_index++;
}
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})));
rawVersions.push(
...hidden.map(tag => ({tag_name: tag, name: tag, prerelease: false}))
);
}
const versions0 = rawVersions.map(async v => {
// Release tags look like one of these:
@@ -148,7 +161,7 @@ export class JetBrainsDistribution extends JavaBase {
const vsplit = vstring.split('b');
let semver = vsplit[0];
const build = +vsplit[1];
const build = vsplit[1];
// Normalize semver
if (!semver.includes('.') && !semver.includes('_'))

View File

@@ -3,11 +3,12 @@
export interface IJetBrainsRawVersion {
tag_name: string;
name: string;
prerelease: boolean;
}
export interface IJetBrainsVersion {
tag_name: string;
semver: string;
build: number;
build: string;
url: string;
}