Skip to content

Commit

Permalink
fix(datasource/dart-version): skip old svn revisions (#34059)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Feb 6, 2025
1 parent f975b74 commit ad7ae2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/modules/datasource/dart-version/__fixtures__/beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"channels/beta/release/2.19.0-255.2.beta/",
"channels/beta/release/2.19.0-374.1.beta/",
"channels/beta/release/2.19.0-374.2.beta/",
"channels/dev/release/30039/",
"channels/dev/release/30104/",
"channels/beta/release/latest/"
]
}
2 changes: 2 additions & 0 deletions lib/modules/datasource/dart-version/__fixtures__/stable.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"channels/stable/release/2.18.0/",
"channels/stable/release/2.18.4/",
"channels/stable/release/2.18.5/",
"channels/stable/release/30036/",
"channels/stable/release/30107/",
"channels/stable/release/latest/"
]
}
8 changes: 8 additions & 0 deletions lib/modules/datasource/dart-version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type { GetReleasesConfig, Release, ReleaseResult } from '../types';
import type { DartResponse } from './types';

export const stableVersionRegex = regEx(/^\d+\.\d+\.\d+$/);
/**
* The server returns old svn versions which would need mapping to a version.
* They are very old, so we skip them instead.
* https://github.com/dart-lang/site-www/blob/7d4409c87bb6570b2d8870b20283f81f2b7e08fc/tool/get-dart/dart_sdk_archive/lib/src/svn_versions.dart#L2
*/
export const svnVersionRegex = regEx(/^\d+$/);

export class DartVersionDatasource extends Datasource {
static readonly id = 'dart-version';
Expand Down Expand Up @@ -65,6 +71,8 @@ export class DartVersionDatasource extends Datasource {
.filter((version) => {
if (
version === 'latest' ||
// skip old svn versions
svnVersionRegex.test(version) ||
// The API response contains a stable version being released as a non-stable
// release. So we filter out these releases here.
(channel !== 'stable' && stableVersionRegex.test(version))
Expand Down

0 comments on commit ad7ae2a

Please sign in to comment.