From 219e4ee7756900e5fa2399d4f0d8fe1223fb14db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:54:35 +0000 Subject: [PATCH 1/3] Stabilize JetBrains tests by removing external network dependency Agent-Logs-Url: https://github.com/AKB0700/setup-java/sessions/b5ff7a8f-7d53-4825-9148-a3d7b9163aac Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com> --- .../distributors/jetbrains-installer.test.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/__tests__/distributors/jetbrains-installer.test.ts b/__tests__/distributors/jetbrains-installer.test.ts index bf1dc15da..f8b705177 100644 --- a/__tests__/distributors/jetbrains-installer.test.ts +++ b/__tests__/distributors/jetbrains-installer.test.ts @@ -1,4 +1,3 @@ -import https from 'https'; import {HttpClient} from '@actions/http-client'; import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer'; @@ -17,6 +16,11 @@ describe('getAvailableVersions', () => { headers: {}, result: [] }); + jest.spyOn(HttpClient.prototype, 'head').mockResolvedValue({ + message: { + statusCode: 200 + } + } as any); // Mock core.error to suppress error logs spyCoreError = jest.spyOn(core, 'error'); @@ -84,14 +88,9 @@ describe('findPackageForDownload', () => { distribution['getAvailableVersions'] = async () => manifestData as any; const resolvedVersion = await distribution['findPackageForDownload'](input); - const url = resolvedVersion.url; - const options = {method: 'HEAD'}; - - https.request(url, options, res => { - // JetBrains uses 403 for inexistent packages - expect(res.statusCode).not.toBe(403); - res.resume(); - }); + expect(resolvedVersion.url).toMatch( + /^https:\/\/cache-redirector\.jetbrains\.com\/intellij-jbr\// + ); } ); From 3ffaf5bec1d10e2923529e7ad0b331eeb0d7dee4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:59:12 +0000 Subject: [PATCH 2/3] Add JetBrains fallback tests and tighten URL assertions Agent-Logs-Url: https://github.com/AKB0700/setup-java/sessions/b5ff7a8f-7d53-4825-9148-a3d7b9163aac Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com> --- .../distributors/jetbrains-installer.test.ts | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/__tests__/distributors/jetbrains-installer.test.ts b/__tests__/distributors/jetbrains-installer.test.ts index f8b705177..59ed63f12 100644 --- a/__tests__/distributors/jetbrains-installer.test.ts +++ b/__tests__/distributors/jetbrains-installer.test.ts @@ -54,6 +54,61 @@ describe('getAvailableVersions', () => { os.platform() === 'win32' ? manifestData.length : manifestData.length + 2; expect(availableVersions.length).toBe(length); }, 10_000); + + it('uses _nomod package URL when base package is unavailable', async () => { + spyHttpClient.mockReturnValueOnce({ + statusCode: 200, + headers: {}, + result: [{tag_name: 'jbr-release-21.0.3b465.3', prerelease: true}] as any + }); + spyHttpClient.mockReturnValueOnce({ + statusCode: 200, + headers: {}, + result: [] + }); + jest + .spyOn(HttpClient.prototype, 'head') + .mockResolvedValueOnce({message: {statusCode: 404}} as any) + .mockResolvedValueOnce({message: {statusCode: 200}} as any); + + const distribution = new JetBrainsDistribution({ + version: '21-ea', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + + expect(availableVersions).toHaveLength(1); + expect(availableVersions[0].url).toContain('_nomod-21.0.3-linux-x64-b465.3'); + }); + + it('filters out versions when both package URLs are unavailable', async () => { + spyHttpClient.mockReturnValueOnce({ + statusCode: 200, + headers: {}, + result: [{tag_name: 'jbr-release-21.0.3b465.3', prerelease: true}] as any + }); + spyHttpClient.mockReturnValueOnce({ + statusCode: 200, + headers: {}, + result: [] + }); + jest + .spyOn(HttpClient.prototype, 'head') + .mockResolvedValueOnce({message: {statusCode: 404}} as any) + .mockResolvedValueOnce({message: {statusCode: 404}} as any); + + const distribution = new JetBrainsDistribution({ + version: '21-ea', + architecture: 'x64', + packageType: 'jdk', + checkLatest: false + }); + const availableVersions = await distribution['getAvailableVersions'](); + + expect(availableVersions).toHaveLength(0); + }); }); describe('findPackageForDownload', () => { @@ -89,7 +144,7 @@ describe('findPackageForDownload', () => { const resolvedVersion = await distribution['findPackageForDownload'](input); expect(resolvedVersion.url).toMatch( - /^https:\/\/cache-redirector\.jetbrains\.com\/intellij-jbr\// + /^https:\/\/cache-redirector\.jetbrains\.com\/intellij-jbr\/.+-b\d+(\.\d+)?\.tar\.gz$/ ); } ); From d65fe6df4424a1a58dde5c3b2715f527de7f1367 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 15:10:23 +0000 Subject: [PATCH 3/3] Use unique Marketplace action name Agent-Logs-Url: https://github.com/AKB0700/setup-java/sessions/5c91e70c-9d6a-4d53-9edf-bdcce4847900 Co-authored-by: AKB0700 <157992575+AKB0700@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 21a4269d7..199cabd49 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Setup Java JDK' +name: 'AKB0700 Setup Java JDK' description: 'Set up a specific version of the Java JDK and add the command-line tools to the PATH' author: 'GitHub'