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
This commit is contained in:
Priya Gupta 2025-07-03 22:33:51 +05:30 committed by GitHub
commit 67aec007b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1486 additions and 1467 deletions

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++;
}
// 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(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;
}