Skip to content

Commit

Permalink
fix(scripts): skip invalid semver (#4284)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Dec 24, 2024
1 parent 07ce2f8 commit a57612a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions scripts/release/__tests__/versionsHistory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,42 @@ describe('no new releases', () => {
});
});

it('skips invalid versions', () => {
const versions = generateLanguageVersionsHistory(
[
'1.2.4 Thu Dec 28 15:48:25 2023 +0000',
'1.1 Thu Dec 28 15:48:25 2023 +0000',
'1.2.5 Tue Jan 2 14:17:11 2024 +0000',
'1.2.6 Tue Jan 2 15:26:06 2024 +0000',
'1.2.7 Thu Jan 4 15:09:11 2024 +0000',
],
{ current: '1.2.7', next: '1.2.7' },
);

expect(versions).toEqual({
'1.2.4': {
releaseDate: '2023-12-28',
slaStatus: 'eligible',
supportStatus: 'eligible',
},
'1.2.5': {
releaseDate: '2024-01-02',
slaStatus: 'eligible',
supportStatus: 'eligible',
},
'1.2.6': {
releaseDate: '2024-01-02',
slaStatus: 'eligible',
supportStatus: 'eligible',
},
'1.2.7': {
releaseDate: '2024-01-04',
slaStatus: 'eligible',
supportStatus: 'eligible',
},
});
});

it('parses version of different minor', () => {
const versions = generateLanguageVersionsHistory(
[
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/versionsHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function generateLanguageVersionsHistory(
}

// we skip any form of pre-releases because they are not part of the VersionsHistory
if (isPreRelease(tagVersion)) {
if (isPreRelease(tagVersion) || !semver.valid(tagVersion)) {
continue;
}

Expand Down

0 comments on commit a57612a

Please sign in to comment.