mirror of
https://github.com/actions/setup-java.git
synced 2026-07-08 14:21:50 +00:00
Merge branch 'main' into set-default
This commit is contained in:
commit
27fb8e6d8c
@ -1058,6 +1058,20 @@ describe('GraalVMDistribution', () => {
|
|||||||
'GraalVM Community does not provide early access builds'
|
'GraalVM Community does not provide early access builds'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should surface an error when the releases listing is not an array', async () => {
|
||||||
|
mockHttpClient.getJson.mockResolvedValue({
|
||||||
|
result: {message: 'API rate limit exceeded'},
|
||||||
|
statusCode: 403,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(communityDistribution as any).findPackageForDownload('21')
|
||||||
|
).rejects.toThrow(
|
||||||
|
/Unexpected response while listing GraalVM Community releases.*HTTP status code: 403/s
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
@ -79314,7 +79314,17 @@ class GraalVMCommunityDistribution extends GraalVMDistribution {
|
|||||||
let releasesUrl = GRAALVM_COMMUNITY_RELEASES_URL;
|
let releasesUrl = GRAALVM_COMMUNITY_RELEASES_URL;
|
||||||
for (let pageIndex = 0; releasesUrl && pageIndex < util_1.MAX_PAGINATION_PAGES; pageIndex++) {
|
for (let pageIndex = 0; releasesUrl && pageIndex < util_1.MAX_PAGINATION_PAGES; pageIndex++) {
|
||||||
const response = yield this.http.getJson(releasesUrl, headers);
|
const response = yield this.http.getJson(releasesUrl, headers);
|
||||||
const releases = Array.isArray(response.result) ? response.result : [];
|
// A successful GitHub releases listing is always a JSON array (possibly
|
||||||
|
// empty). Anything else indicates an unexpected/error payload (rate
|
||||||
|
// limiting, auth failure, etc.) that must be surfaced instead of being
|
||||||
|
// silently treated as "no releases", which would later look like a
|
||||||
|
// misleading "version not found" error.
|
||||||
|
if (!Array.isArray(response.result)) {
|
||||||
|
throw new Error(`Unexpected response while listing GraalVM Community releases from ${releasesUrl} ` +
|
||||||
|
`(HTTP status code: ${response.statusCode}). Expected a JSON array of releases. ` +
|
||||||
|
`Please check if the service is available at ${GRAALVM_COMMUNITY_DOWNLOAD_URL}.`);
|
||||||
|
}
|
||||||
|
const releases = response.result;
|
||||||
if (releases.length === 0) {
|
if (releases.length === 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,8 +187,8 @@ steps:
|
|||||||
distribution: 'graalvm-community'
|
distribution: 'graalvm-community'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: |
|
- run: |
|
||||||
java -cp java HelloWorldApp
|
java --version
|
||||||
native-image -cp java HelloWorldApp
|
native-image --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### JetBrains
|
### JetBrains
|
||||||
|
|||||||
@ -391,7 +391,20 @@ export class GraalVMCommunityDistribution extends GraalVMDistribution {
|
|||||||
headers
|
headers
|
||||||
);
|
);
|
||||||
|
|
||||||
const releases = Array.isArray(response.result) ? response.result : [];
|
// A successful GitHub releases listing is always a JSON array (possibly
|
||||||
|
// empty). Anything else indicates an unexpected/error payload (rate
|
||||||
|
// limiting, auth failure, etc.) that must be surfaced instead of being
|
||||||
|
// silently treated as "no releases", which would later look like a
|
||||||
|
// misleading "version not found" error.
|
||||||
|
if (!Array.isArray(response.result)) {
|
||||||
|
throw new Error(
|
||||||
|
`Unexpected response while listing GraalVM Community releases from ${releasesUrl} ` +
|
||||||
|
`(HTTP status code: ${response.statusCode}). Expected a JSON array of releases. ` +
|
||||||
|
`Please check if the service is available at ${GRAALVM_COMMUNITY_DOWNLOAD_URL}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const releases = response.result;
|
||||||
if (releases.length === 0) {
|
if (releases.length === 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user